Javascript examples for Browser Object Model:Location
Location hash Property - Set the anchor part:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w . ja v a2s. c o m*/ location.hash = "part5"; var x = "The anchor part is now: " + location.hash; document.getElementById("demo").innerHTML = x; } </script> </body> </html>