Created
November 14, 2014 23:25
-
-
Save anonymous/a3aa8b237300008b8f33 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/yehuvemili
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<p>Click the button to change the anchor part of the current URL to #part5</p> | |
<button onclick="changePart()">Try it</button> | |
<p id="demo"></p> | |
<script id="jsbin-javascript"> | |
// Using the location.hash property to change the anchor part | |
function changePart() { | |
location.hash = "part5"; | |
var x = "The anchor part is now: " + location.hash; | |
document.getElementById("demo").innerHTML = x; | |
} | |
// Alert some text if there has been changes to the anchor part | |
function myFunction() { | |
alert("The anchor part has changed!"); | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">// Using the location.hash property to change the anchor part | |
function changePart() { | |
location.hash = "part5"; | |
var x = "The anchor part is now: " + location.hash; | |
document.getElementById("demo").innerHTML = x; | |
} | |
// Alert some text if there has been changes to the anchor part | |
function myFunction() { | |
alert("The anchor part has changed!"); | |
}</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using the location.hash property to change the anchor part | |
function changePart() { | |
location.hash = "part5"; | |
var x = "The anchor part is now: " + location.hash; | |
document.getElementById("demo").innerHTML = x; | |
} | |
// Alert some text if there has been changes to the anchor part | |
function myFunction() { | |
alert("The anchor part has changed!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment