Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Help With Javascript And Iframe

7:10 pm on Jan 27, 2008 (gmt 0)

Full Member

10+ Year Member

joined:June 16, 2004
votes: 0

Trying to change the src of an iframe however its not working?

<script language="javascript">
document.frames['gorsel'].location.href = 'http://www.google.com';

<iframe id="gorsel" src="about:blank"></iframe>

11:02 pm on Jan 27, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 3, 2005
votes: 0

You need to wait until page is load, use onload on body to call function.

ps Also try "src" instead of "location.href"

[edited by: daveVk at 11:22 pm (utc) on Jan. 27, 2008]