Turning Table TD Mouseover On and Off

He has: 4 posts

Joined: Jul 2005

I have a table where some (not all) of the TD entries need to react to a MouseOver, and I need to turn the MouseOver on and off from Javascript. The application is a photo gallery website. The MouseOver currently changes the cell background color and pointer. Examples of where MouseOver would need to be enabled and disabled:
1) Table cell that contains "Previous" needs to have Mouseover (changes background color and pointer) and OnClick (calls Javascrip function) when any image but the first in the series is displayed, needs to have both Mouseover and OnClick disabled when the first image in the series is displayed.
2) Similar for "Next"
3) Similar for "Purchase Print". If print is available for sale, want to have mouseover change cell background and pointer and have onclick active. If print is NOT available for sale, want to disable mouseover and onclick, or otherwise make them inactive.

Below is the current code.

---- Javascript ----
function prev_image () {
if (image_index > 0) {
image_index--;
document.the_pix.src = image_names[image_index];
}
if (image_index > 0) {
document.getElementById('the_text').firstChild.nodeValue=image_titles[image_index];
document.getElementById('prev_button').firstChild.nodeValue='Previous Image';
document.getElementById('next_button').firstChild.nodeValue='Next Image';
}
else {
document.getElementById('prev_button').firstChild.nodeValue=' ';
document.getElementById('next_button').firstChild.nodeValue='Next Image';
}
document.getElementById('swap_button').firstChild.nodeValue=
'Image Count: '+image_count+' Index: '+image_index+' Swap';
}

---- and Table TD entry ----

 

Thoughts?

Thanks!

John