Location assign() Method - Javascript Browser Object Model

Javascript examples for Browser Object Model:Location

Description

The assign() method loads a new document.

Parameter Values

Parameter Type Description
URL String Required. URL of the page to navigate to

Return Value

No return value

The following code shows how to Load a new document:

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials