U
UKuser
Hi,
I have a function that picks up iPd as a value and I then want it to
pass it to return the specific image:
na = new Image();na.src = "world/na_over.gif";
sa = new Image();sa.src = "world/sa_over.gif";
eu = new Image();eu.src = "world/eu_over.gif";
if (action=='over'){
document.getElementById(iPd).src = iPd.src; [Where iPd is na or
sa]
}
I have tried using an array:
countries = new Array();
countries['eu'] = eu.src;
if (action=='over'){
document.getElementById(iPd).src = countries[iPd];
}
But this won't work either. I'm sure its something simple - just
missing the obvious of how to pass the value to either countries[] or
reference it directly. (in PHP I could use variable variables but
don't believe this can be done in JS)
Many thanks
A
I have a function that picks up iPd as a value and I then want it to
pass it to return the specific image:
na = new Image();na.src = "world/na_over.gif";
sa = new Image();sa.src = "world/sa_over.gif";
eu = new Image();eu.src = "world/eu_over.gif";
if (action=='over'){
document.getElementById(iPd).src = iPd.src; [Where iPd is na or
sa]
}
I have tried using an array:
countries = new Array();
countries['eu'] = eu.src;
if (action=='over'){
document.getElementById(iPd).src = countries[iPd];
}
But this won't work either. I'm sure its something simple - just
missing the obvious of how to pass the value to either countries[] or
reference it directly. (in PHP I could use variable variables but
don't believe this can be done in JS)
Many thanks
A