Last active
December 10, 2015 12:18
-
-
Save santosh/4433077 to your computer and use it in GitHub Desktop.
JavaScript: An example of changing link on the time when user clicks on it..
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> | |
<title>Changing Link on Click</title> | |
<script type="text/javascript" charset="utf-8"> | |
var changeLink = function(){ | |
document.getElementById('change').onClick = function(){ | |
// link to be replaced with | |
this.href="https://twitter.com/"; | |
} | |
} | |
window.onload = changeLink; | |
</script> | |
</head> | |
<body> | |
<a href="http://www.google.com/ncr" target="_blank" id="change" title="Link to Google">The Link</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment