PDA

View Full Version : constipated mouseover


richard777
09-05-2001, 01:39 PM
Hi,

I have a problem with a mouseover script. It works in IE5 but not in Netscape 4.74 or 6.01.

Perhaps someone could look at it and give me a clue. http://members.networld.com/rdh777/

Also, I am wondering if anyone might know why the
<SPACER TYPE=... tag will work in Netscape 4.74 but not in 6.01? What is the equivalent for IE5? Or where could I get clear info on this?

Thanks in advance,

Richard

scoutt
09-05-2001, 05:38 PM
try adding quotes around teh number

<SCRIPT>
<!--
function chkVer(imagename,objectsrc)
{
var n=navigator.appName
var v=parseInt(navigator.appVersion)
var browsok=((n=="Netscape")&&(v >= "3"))
var browsok2=((n=="Microsoft Internet Explorer")&&(v>=4))
if ((browsok)||(browsok2))
document.images[imagename].src=eval(objectsrc+".src")
}
//-->
</SCRIPT>

other than that I have no idea as to why. it looks like it wants too but doesn't go.
as far as the spacer tag I don't know anything on that either. hell why am I even here :D

montroze
09-05-2001, 07:39 PM
Nothing like being honest :)

Jon Hanlon
09-05-2001, 09:56 PM
The eval() method takes a string and returns an object reference.
Thus eval("window") returns a reference to the window object - these two are equivalent:
var myWin = window;
var myWin = eval("window");

Your code:
document.images[imagename].src=eval(objectsrc+".src")

is trying to set the src property of an image (a string) to an object reference. Assuming objectsrc is a string, then you don't want the eval(), just
document.images[imagename].src= objectsrc + ".src"
If, on the other hand, objectsrc is an object reference, you need
document.images[imagename].src = objectsrc.src
or, for a general approach
document.images[imagename].src = (typeof(objectsrc) == "string) ? objectsrc + ".src" : objectsrc.src;

scoutt
09-05-2001, 11:15 PM
Originally posted by montroze
Nothing like being honest :)
:) what can I say.

thanks jon for clearing that up. :)

scoutt
09-05-2001, 11:55 PM
oh I looked for spacer tag and it was dropped from ns6 and IE5+

you can try using <pre></pre> tags.