Created
February 25, 2011 13:42
-
-
Save kenkam/843789 to your computer and use it in GitHub Desktop.
This file contains 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
<html> | |
<head> | |
<script type="text/javascript"> | |
// when the document has finished loading... | |
window.onload = function() { | |
// get the element with my_link as ID, and bind a callback for the onclick event | |
document.getElementById("my_link").onclick = function() { | |
// change the CSS style declared when the link is clicked | |
document.getElementById("my_div").innerHTML = '<p>A new paragraph</p>'; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<a href="#" id="my_link">click here</a> | |
<div id="my_div"><p>Some stuff here...</p></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment