Assign a URL to location : location « Javascript Objects « JavaScript DHTML






Assign a URL to location

  
    
<html>
<body>
<script language="JavaScript">
    function function1() {
        location.assign("http://www.java2s.com/");
    }
</script>
<input type="button" value="Load new page" onclick="function1();">
</body>
</html>

    
      
        
    
  








Related examples in the same category

1.Location replace
2.Location reload
3.Display properties in location
4.If location is a search, display its value
5.location.reload(true) and history.go(0)
6.Invoking the location.replace() Method