M
Matt
i know more-or-less zero about javascript, but my client wants a
rollover and he created this code, which doesn't work. All comments are
appreciated.
1. the tag:
<td align="center" width="66" nowrap="nowrap"
background="/work/phc1.10/images/layout/main_nav_bg.gif">
<a href="http://localhost/work/phc1.10/index.php?page=homecare"
onmouseover="imgSwap('','gnav_hc_on','gnav_hc_on')"
onmouseout="imgSwap('','gnav_hc_off','gnav_hc_off')">
<img name="gnav_hc_off"
src="/work/phc1.10/images/layout/gnav/gnav_hc_off.gif" border="0"
alt="Homecare" width="66" height="14" /></a>
</td>
2. the function:
function imgSwap(layer,imgName,imgObj) {
var layer;
var imgName;
var imgObj;
glayer = layer;
gimgName = imgName;
gimgObj = imgObj;
if(document.images) {
//NN 4.x DOM
if(document.layers && layer != "") {
eval('document.' + layer + '.document.images["' + imgName + '"].src =
' + imgObj + '.src');
}
//NN6 Gecko subroutine
else if((objClient.application == "nn") && (objClient.version >= 5)) {
imgSwapTimeOut();
}
else {
document.images[imgName].src = eval(imgObj + ".src");
}
}
}
//NN Gecko subroutine
function imgSwapTimeOut() {
document.images[gimgName].src = eval(gimgObj + ".src");
}
rollover and he created this code, which doesn't work. All comments are
appreciated.
1. the tag:
<td align="center" width="66" nowrap="nowrap"
background="/work/phc1.10/images/layout/main_nav_bg.gif">
<a href="http://localhost/work/phc1.10/index.php?page=homecare"
onmouseover="imgSwap('','gnav_hc_on','gnav_hc_on')"
onmouseout="imgSwap('','gnav_hc_off','gnav_hc_off')">
<img name="gnav_hc_off"
src="/work/phc1.10/images/layout/gnav/gnav_hc_off.gif" border="0"
alt="Homecare" width="66" height="14" /></a>
</td>
2. the function:
function imgSwap(layer,imgName,imgObj) {
var layer;
var imgName;
var imgObj;
glayer = layer;
gimgName = imgName;
gimgObj = imgObj;
if(document.images) {
//NN 4.x DOM
if(document.layers && layer != "") {
eval('document.' + layer + '.document.images["' + imgName + '"].src =
' + imgObj + '.src');
}
//NN6 Gecko subroutine
else if((objClient.application == "nn") && (objClient.version >= 5)) {
imgSwapTimeOut();
}
else {
document.images[imgName].src = eval(imgObj + ".src");
}
}
}
//NN Gecko subroutine
function imgSwapTimeOut() {
document.images[gimgName].src = eval(gimgObj + ".src");
}