Javascript examples for Browser Object Model:Location
The assign() method loads a new document.
Parameter | Type | Description |
---|---|---|
URL | String | Required. URL of the page to navigate to |
No return value
The following code shows how to Load a new document:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Load new document</button> <script> function myFunction() {// www . j a va2s .co m location.assign("http://www.java2s.com"); } </script> </body> </html>