Created
November 30, 2011 16:03
-
-
Save tamewhale/1409611 to your computer and use it in GitHub Desktop.
Changing the data attribute of an object
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
<div id="scrollee" style="height:75%;" > | |
<object id="object" height="90%" width="100%" type="text/html" data="http://en.wikipedia.org/"></object> | |
</div> | |
<a id="change-link" href="http://yahoo.com">link</a> | |
<script type="text/javascript"> | |
window.onload = function() { | |
var el = document.getElementById("change-link"); | |
el.onclick = function() { | |
var target = this.getAttribute("href"); | |
var el = document.getElementById("object"); | |
el.setAttribute("data", target); | |
return false; | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment