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

  • 1. kathmandu flights  |  November 18, 2009 at 12:47 pm

    how could this code be useful for me in ethical ways?

    Reply

Leave a Comment

Required

Required, hidden

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


Spam Blocked

Flickr Photos

Night - The Ice Maiden!

skip's

Clifftop Path - Carlingheugh Bay

More Photos

Blogroll

Recent Posts

Recent Comments

munin on WordPress Themes
miley cyrus naked on Mozilla Addons and IE Addons f…
izdelava spletnih st… on min-height hack/workaround in …
kathmandu flights on iframe change src | javas…
Ali A. Akbar on min-height hack/workaround in …

Pages

Top Clicks

Top Posts

Blog Stats