Click to See Complete Forum and Search --> : multiple variables


zealous
08-26-2003, 06:28 PM
I have a working rollover script I want to be able to change two images with an onmouseover function I have one working already.

the image wirks with the script using its name, I tryed using top() and then in the script using e.g top(1), top(2) but I don't know how to do it properly.
heres the script:

<script>
if (document.images) {
access_over = new Image(); access_over.src = "images-menu/access_info_over.gif";
business_over = new Image(); business_over.src = "images-menu/business_over.gif";
top(1)_over = new Image(); top(1)_over.src = "images-menu/ai.gif";
top(2)_over = new Images(); top(2)_over.scr = "images-menu/b.gif";
}
function img_activate(imgName,icon,label) {
if (document.images) {
imgOn=eval(imgName + "_over.src");
document.images[imgName].src = imgOn;
} else {
document.images[imgName].src = icon;
}

window.status=label;
}
function img_deactivate(imgName,icon) {
// return true;
document.images[imgName].src = icon;
window.status='';
}
</script>

the images go like this:

<img src="images-menu/transparent.gif" name="top()"><br>
<a onmouseover="img_activate('access','',''); img_activate('top(1)','',''); return true;" onmouseout="img_deactivate('access','images-menu/access_info.gif'); img_deactivate('top(1)','images-menu/transparent.gif'); return true;" href="index.php"><img src="images-menu/access_info.gif" name="access" border="0"></a><br>
<a onmouseover="img_activate('business','',''); img_activate('top(2)','',''); return true;" onmouseout="img_deactivate('business','images-menu/business.gif'); img_deactivate('top(2)','images-menu/transparent.gif'); return true;" href="?pg=business/main.php"><img src="images-menu/business.gif" name="business" border="0"></a><br>
I have the script here:
http://zealous.net.nz/dans_temp/index.php

Khalid Ali
08-26-2003, 11:24 PM
try this link and see if you can utilise the code...

http://www.webapplikations.com/pages/html_js/image_examples/DisplayTwoImagesClickOver.html