अवलोकन
onhashchange इवेंट तब होता है जब URL का एंकर भाग (हैश) बदलता है।
उदाहरण
<!DOCTYPE html> <html> <body onhashchange="newFunc"> <button onclick="functionChange()">Click to change anchor</button> <script> function functionChange() { location.hash = "about"; var hash = location.hash; document.write("The anchor part is now: " + hash); } // If the achor part is changed function newFunc() { alert("Anchor part changed!"); } </script> </body> </html>