change the src property of iframe using javascript

A

azeet.chebrolu

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
 
M

mike

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
 
R

Randy Webb

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.
 
G

gimme_this_gimme_that

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...
 
R

Randy Webb

(e-mail address removed) 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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top