473,390 Members | 1,235 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,390 software developers and data experts.

pic and text to iframe, works in IE but not Netscape

I have code that works in IE but not Netscape 7+. This code allows me
to have a list of links that bring up an image and description in an
iframe. This works great in IE, however I have users that are
Netscape users.
main page:

var links=new Array();

links[2]=new Array("picture2.jpg","Pic 2 link title","Pic 2 image
title");
links[1]=new Array("picture1.jpg","Pic 1 link title","Pic 1 image
title");

function showImg(aNum)
{
document.IFRAMENAME.setup(links[aNum]);
}

// and so on ...

for (var i=links.length-1;i>=0;i--)
{
document.write('<a href="#" onclick=showImg("'+i+'")>' + links[i][1] +
'</a><br>');
}

the iframe file:
<script>
function setup(aLink)
{
document.getElementById("pic").src=aLink[0];
document.getElementById("title").innerHTML=aLink[2];

}
</script>
<body>
<p id="title"></p>
<img src="" id="pic">
</body>

Jul 20 '05 #1
4 1584
Treetop wrote:
I have code that works in IE but not Netscape 7+. This code allows me
to have a list of links that bring up an image and description in an
iframe. This works great in IE, however I have users that are
Netscape users.


<--snip-->
document.IFRAMENAME.setup(links[aNum]);


Stop using IE-shortcut-code and it will work in NS7+:

document.frames['IFRAMENAME'].setup(.......);

--
Randy

Jul 20 '05 #2

"Randy Webb" <hi************@aol.com> wrote in message
news:8t********************@comcast.com...
Treetop wrote:
I have code that works in IE but not Netscape 7+. This code allows me to have a list of links that bring up an image and description in an iframe. This works great in IE, however I have users that are
Netscape users.


<--snip-->
document.IFRAMENAME.setup(links[aNum]);


Stop using IE-shortcut-code and it will work in NS7+:

document.frames['IFRAMENAME'].setup(.......);

--
Randy


Thank you for your help.

I changed
document.external.setup(links[aNum]);

with
document.frames['external'].setup(links[aNum]);

and neither browser worked. If you have time, please tell me what I
am missing.

Jul 20 '05 #3
Treetop wrote:
"Randy Webb" <hi************@aol.com> wrote in message
news:8t********************@comcast.com...
Treetop wrote:
I have code that works in IE but not Netscape 7+. This code
allows me
to have a list of links that bring up an image and description in
an
iframe. This works great in IE, however I have users that are
Netscape users.


<--snip-->
document.IFRAMENAME.setup(links[aNum]);


Stop using IE-shortcut-code and it will work in NS7+:

document.frames['IFRAMENAME'].setup(.......);

--
Randy

Thank you for your help.

I changed
document.external.setup(links[aNum]);

with
document.frames['external'].setup(links[aNum]);

and neither browser worked. If you have time, please tell me what I
am missing.


My bad. Change it to window.frames instead of document.frames.

In blank.html:
window.frames['iFrameName'].myFunction('It works');

In blank2.html:

function myFunction(alertMessage){
alert(alertMessage)
}

And it now works in IE6, Opera 7, NS7, Mozilla1.4

--
Randy

Jul 20 '05 #4
It now works for Netscape, but not IE. I do not have enough beer in
the house for this, lol.
--------------------------------
Here is the code in my test1.html file.
<script language="javascript" type="text/javascript">

var links=new Array();
links[2]=new Array("picture2.jpg","Pic 2 link title","Pic 2 image
title");
links[1]=new Array("picture1.jpg","Pic 1 link title","Pic 1 image
title");

function showImg(aNum)
{
window.frames['external'].setup(links[aNum]);
}

for (var i=links.length-1;i>=0;i--)
{
document.write('<a href="#" onclick=showImg("'+i+'")>' + links[i][1] +
'</a><br>');
}

</script>

<iframe name="external" id="external"
style="width:100%;height:500px" src="picture.html"></iframe>

</body>
</html>
--------------------------------
Here is the code for my iframe file (picture.html)

<script language="javascript">
function setup(aLink)
{
document.getElementById("pic").src=aLink[0];
document.getElementById("title").innerHTML=aLink[2];
}
</script>

<center>
<img src="pic3.jpg" id="pic">
<p id="title">Text for default picture</p>
</center>

--------------------------------
My goal is to have links on a page that will update the iframe with
the image and text from the script. The errors I get from IE 6 are:

Error #1 - When it first loads I get
Error: 'links[...].1' is null or not an object

Error #2 - When I click on a link I get
Object doesn't support this property or method

I used the following line previous and it worked for IE but not for
Netscape, however Error #1 was still there in IE.

document.external.setup(links[aNum]);
in place of
window.frames['external'].setup(links[aNum]);

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dom | last post by:
Hi, Can anyone help me with this teaser ? I have an iframe with id and name set to 'iframe', in which I load a frameset of two frames (lets call them TopFrame and BottomFrame). Inside frame...
3
by: Randell D. | last post by:
Folks, I'm still learning javascript - I've invested in a couple of books and reading online as much as possible. I'm pretty sure what I am suggesting is possible though I'm trying to weigh up...
4
by: Marina Ferguson | last post by:
Hi, I have a document with an iframe. The main doc has a "Print" button. The idea is that when the user clicks it, the contents of the iframe is printed. For some reason instead of the iframe...
2
by: Terry | last post by:
Hello, http://free.hostdepartment.com/j/javashop/this_works.htm http://free.hostdepartment.com/j/javashop/this_doesnot.htm Please take a look of the above two links. The two pages are...
2
by: Brett Robichaud | last post by:
I'm using the HTML below as a transition page. It is shown while a page that takes a long time to load is processed (report.asp). It works just fine under IE6 but not Netscape 7. The...
9
by: Arash Dejkam | last post by:
Hi All, Is it possible to write on an <OBJECT type="text/html"> using document.write() from within the html containing that tag the way we write on a popup window? I couldn't do that after a lot...
4
by: Daz | last post by:
Hi everyone. I am trying to create a handle to an iframe, but the script only gets to a certain point and then fails. I am new to JavaScript, and I have tried everything I can think of, but I...
4
by: R144N | last post by:
Hi Everyone, I've searched variuos forums as much as I could for a similar problem within the time I could and found no helpful solution, I hope someone here can help me out: I have an iFrame...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.