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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rollover images wont work

Status
Not open for further replies.

emms

Programmer
Jan 11, 2001
55
GB
I'm trying to get some javascript working, unfortunately I didn't write it - and the person who did is on holiday!

This seems to work on some machines and not others (even with the same version of ie, 6).

I think the problem is something to do with the eval function, but i'm not sure what to use instead.

any help would be greatly appreciated

thanks

Emma


manu=navigator.appName;
vers=navigator.appVersion;
ie3=0;
window.searchmap.debug.value = document.images;
if (manu.indexOf("Microsoft")>=0 && vers.indexOf("3")>=0) ie3=1;

if (document.images && ie3==0 ) {
var ukon = new Image();
ukon.src = "/home/images/newnav/btn-ukprop-active.gif";
var ukoff = new Image();
ukoff.src = "/home/images/newnav/btn-ukprop.gif";
var euroon = new Image();
euroon.src = "/home/images/newnav/btn-europrop-active.gif";
var eurooff = new Image();
eurooff.src = "/home/images/newnav/btn-europrop.gif";
var agentson = new Image();
agentson.src = "/home/images/newnav/btn-agents-active.gif";
var agentsoff = new Image();
agentsoff.src = "/home/images/newnav/btn-agents.gif";
var contacton = new Image();
contacton.src = "/home/images/newnav/btn-contact-active.gif";
var contactoff = new Image();
contactoff.src = "/home/images/newnav/btn-contact.gif";
var companyon = new Image();
companyon.src = "/home/images/newnav/btn-companyinfo-active.gif";
var companyoff = new Image();
companyoff.src = "/home/images/newnav/btn-companyinfo.gif";

}


function imgOn(imgName) {
if (document.images) {
window.searchmap.debug.value = eval(imgName + "on.src");
document
.src = eval(imgName + "on.src");
}
return true;
}

function imgOff(imgName) {
if (document.images) {
window.searchmap.debug.value = eval(imgName + "off.src");
document
.src = eval(imgName + "off.src");
}

return true;
}
 
what the error message ?

maybe change this :
document
.src = eval(imgName + "on.src");
TO :
eval("document." + imgName + ".src") = eval(imgName + "on.src"); ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
thanks,

I tried that and it didn't work, still get the same error message of:

'eurooff.src' is null or not an object

Emma
 
have u tested my line on both imgOn() imgOff() ? ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
yes, no luck.

I get the error for both imgOn() and imgOff()
 
do u have a <img name=&quot;euro&quot; ...> in your <body> ? ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
yes, all the images are defined. forgot show how i was calling it:
<A class=&quot;navbar&quot; href=&quot;/index.asp?&quot;><IMG src=&quot;/home/images/newnav/btn-europrop.gif&quot; border=&quot;0&quot; name=&quot;euro&quot; onMouseOver=&quot;window.status=''; return imgOn('euro');&quot; onMouseOut=&quot;window.status=''; return imgOff('euro');&quot;></A>

I've got to go home now, and i'm not at work till monday. So thanks for all your help - and i'll probably be pestering you then!

thankyou for taking the time to help

Emma
 
get rid of the returns in : <a> , imgOn() and imgOff() ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
still doesn't work

so it now reads:

<A class=&quot;navbar&quot; href=&quot;/index.asp?&quot;><IMG src=&quot;/home/images/newnav/btn-europrop.gif&quot; border=&quot;0&quot; name=&quot;euro&quot; onMouseOver=&quot;window.status=''; imgOn('euro');&quot; onMouseOut=&quot;window.status=''; imgOff('euro');&quot;></A>


Emma
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top