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> 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
"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.
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
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]); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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)...
|
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...
|
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....
|
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...
| | |