By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

change the src property of iframe using javascript

P: n/a
Hi All,
I am trying to update the location of an IFRAME using javascript.My
script works fine when the target link is some .htm or .asp but the
script fails when the link is a cgi program.the script executes but
nothing happens.i mean the IFRAME page will not get updated.

the script is
document.all.myFrame.src = "test.asp"; //works
document.all.myFrame.src = "/srvs/cgi-bin/myCGI.exe?operation";
//fails.

Any help is greatly appriciated.
Thanks in advance.
Azeet

Dec 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
If you had some iframe like:

<iframe src='test.asp' name='miketest' id='miketest' height='100%'
width='100%' scrolling='auto' frameborder='0'></iframe>

and you wanted to change from test.asp to myCGI.exe you would use:

document.getElementById('miketest').src='myCGI.exe ';

That is IF you were using IE.

Mike

Dec 20 '05 #2

P: n/a
mike said the following on 12/20/2005 5:55 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.
If you had some iframe like:

<iframe src='test.asp' name='miketest' id='miketest' height='100%'
width='100%' scrolling='auto' frameborder='0'></iframe>

and you wanted to change from test.asp to myCGI.exe you would use:

document.getElementById('miketest').src='myCGI.exe ';

That is IF you were using IE.


window.frames['IFrameNAMEnotID'].location.href='myCGI.exe';

And now, you are not limited to IE but to browsers that support IFrames
and dynamic scripting of them.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

Dec 20 '05 #3

P: n/a
Until someone explains why it's useful to bother with the nonstandard
follow up method it's better to reply by clicking on the anchor tag.

Clicking the Reply anchor tag works great...

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.


Dec 20 '05 #4

P: n/a
gi*******************@yahoo.com said the following on 12/20/2005 6:19 PM:
Until someone explains why it's useful to bother with the nonstandard
follow up method it's better to reply by clicking on the anchor tag.

Clicking the Reply anchor tag works great...


I guess it does for those of lesser intelligence.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Dec 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.