iframe change src | javascript
July 27, 2009
A small snippet for the people who wanna change src of Iframe on click.
Example
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<script type=”text/javascript”>
function changeURL(id){
alert(id);
newURL=”http://yahoo.com”;
document.getElementById(id).src=newURL;
}
</script>
</head>
<body>
<form name=”testForm”>
<iframe id=”test” name=”testName” src=”http://google.com”></iframe>
</form>
<a href=”#” onclick=”changeURL(‘test’);”>dfdfd</a>
</body>
</html>
Entry Filed under: Javascript. .
1 Comment Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed



1.
kathmandu flights | November 18, 2009 at 12:47 pm
how could this code be useful for me in ethical ways?