Tuesday, September 20, 2011

Basic IFrame Use with JavaScript

Here is the simplest example:

<html>
<body>
<iframe id="smedly" src="http://www.google.com"></iframe>
<input type="button" onclick="dothis();" value="Yahoo">
<script>
function dothis(){
document.getElementById('smedly').setAttribute('src','http://www.yahoo.com');
}
</script>
</body>
</html>



No comments: