Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please explain.....

Status
Not open for further replies.

Yogi39

Technical User
Jun 20, 2001
273
0
0
CA
I use this code stand alone and it works fine in both NS and IE. When I incorporate on another page with other functions I get the following error in NS ONLY......:

document.images
has no properties.
JavaScript Error:
Code:
file:/D:/Documents%20and%20Settings/Desktop/Pics/Frame/2NetTree.html,
line 31:
the funtion is as follows:

<!--
if (document.images) 
{
  img1=new Image();
  img1.src=&quot;Images/2PlayButtonU.jpg&quot;;
  img2=new Image();
  img2.src=&quot;Images/2PlayButtonD.jpg&quot;;
}

function change(imgNumb,imgFile) 
{ if (document.images)
    { document.images[img]umb[/img].src = eval(imgFile + '.src'); }
}
//-->
</script>
[code]
PLease help...Thanks! 



 

 
iza (Programmer) Sep 20, 2001 
maybe because imgNumb > images.length

Not quite sure what you mean ?
 
Code:
line 31 is :
{ document.images[img]umb[/img].src = eval(imgFile + '.src');
Please refer to my 2 other post it might help explain problem better...:)
 
iza means that the index you are trying to use may be 'out of bounds' - meaning it is not in the range:

0<index<=images.length-1.

Where do you get the index from?

:)
 
yes, but yogi why are you creating new threads when your problem is getting explained in your older threads ???? it's only confusing everyone and what's worst, instead of ALL working for you on the same problem we work on piece of your problem without knowing each other's sugestions ... this is not very wise ...
anyway i explained this boundary problems in one of your other threads :(
 
Sorry for the multiple posts :(

As for the Index...I guess I dont get it from anywhere.
I would have to guess that the other scipts on the same page are conflicting.....

What puzzles me though is why would there be no problems in IE and only in NS ?

And once again thanks for your patience....

 
you are missing a value for imgNumb
so javascript does not see the object because it really does not exist if imgNumb = null
 
At this point should I just used another rollover scrpit ?
 
change your function to :

function change(imgNumb,imgFile) {
alert(imgNumb)
if (document.images){ document.images
.src = eval(imgFile + '.src'); }
}

if the pop up shows either 'null' or a number >= 2 or 'undefined', post us the part of your code where you CALL this function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top