473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

change the src property of iframe using javascript

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
4 3582
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: hqi | last post by:
Hi I'm src: <TD WIDTH=559 HEIGHT=100%> <script language="JavaScript"> document.write("<iFRAME WIDTH=559 height=100% SRC='dane.html'></iframe> "); ... I would like to change size (HEIGHT i...
2
by: Radu | last post by:
Hi, I have a "select" control named "cboSelectScorecardType", defined as <select id="cboSelectScorecardType" size="1" runat="server"> </select> which shows a list of files on my drive. It...
4
by: Jo Claes | last post by:
Hi, A friend asked me if i could help him building a lilttle website. Having 10 years of proffessional experiance in writing "non-webbased" code i thought that will not be that hard. I think...
9
by: jad2006 | last post by:
Hi guys We have a requirement like in one iframe we have to show one site and in another iframe we have to show some other external site, we did it using <iframe src="http://www.a.com">...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.