473,320 Members | 2,073 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,320 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 1578
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.