[RESOLVED] Dynamically change onmouseout value on image rollover?
Here's my guidelines to help you understand...
The hearing aid has three switches.
An image is created for each switch being selected. (3 images)
The first switch is the off button or stops any sound playing when selected.
The second switch upon selection plays a sound file of somebody talking
The third switch upon selection plays a sound file of the same person talking but also with background noise.
A polygon area has been created for each switch as part of an image map. (3 areas)
When a switch is selected (let's say switch 1), the other switch areas upon mouse rollover are highlighted in yellow (either switch area 2 or switch area 3) but the switch that was selected (switch 1) doesnt change upon mouse rollover. So this had me create 2 more images per switch displaying the switch selected and the two other areas highlighted. In total this is 9 images.(3 imaged per switch + (3switches * 2 switch areas highlighted) = 9).
The image names are as followed HearingAid(switch number)(nothing,“a”, or “b”) corresponding which switch is highlighted; “a” being bottom most switch area different than switch that's selected and “b” being top most switch area. So they are HearingAid1.png, HearingAid1a.png, HearingAid1b.png HearingAid2.png, HearingAid2a.png, HearingAid2b.png, HearingAid3.png, HearingAid3a.png, HearingAid3b.png.
The original image will change to the appropriate image out of the 9 images I created based upon left clicking an area to select the switch and mousing over other switches which are then highlighted.
My first problems from my first few attempts was that when I selected a different switch from the original off switch, my onmouseout for all switch areas was programmed to revert to the original off switch image and not the image I selected. So I thought I needed to dynamically change those attribute values to new ones every time I selected a new switch. I couldn't find anything in my research that would help me since I tried a lot of things and saw them all fail when testing them out.
My latest attempt I thought had the most potential but it seems like the onclick attribute is working at all. I can't figure out why either.
I would forget about trying to swap event handlers. I think the simplest fix for this is simply to have a permanent variable called switchPos initially set to 1, to represent the default switch position.
Each onclick handler sets switchPos to 1, 2 or 3 as appropriate then loads the appropriate image then .
Then the mouseover/out handlers can read the value of switchPos to decide whether or not to swap anything.