Can't Find the Bug - Mouse off function
Posted: Sat Oct 17, 2009 9:49 am
I am developing an application for a site selling eco friendly computers and accessories. On the page are displayed different accessories (wireless vs standard mouse, different monitors, etc). Next to each type of accessory are images I've made into buttons which, on mouse over not only does the button change, but the image of the accessory changes to the appropriate accessory image. When one of the buttons is selected, even if one mouse-overs another button (and the accessory image for that buttons appears) the accessory image should return to the selected image on mouse out, but this was not working. I finally got it to work for one set of accessory images and buttons with a function that causes the proper accessory image to display on mouse-out and thought I was home free. For the next set I created the same type of function, but when I insert the second function into the code, the whole page breaks and it's basically the exact same function with a different name. I've looked for missing semi-colons, quotes, parenthesis, etc. - can't find the bug.
Here's the code:
This works:
The following function which is pretty much a duplicate of the above function, when inserted into the page, not only does not work, but breaks the whole page:
Oddly enough, when I put in the second function with only the first if statement it doesn't break the page, but of course I don't get the function working either. If I add any of the other if statements, it breaks the page.
Any idea what I'm missing?
Thanks, denewey
Here's the code:
This works:
Code: Select all
function outMouse(){
if (document.none.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/none_selected.gif")
//alert(document.none.src);
document.mswls.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/mouse_standard.jpg";
if (document.basic.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/basic_select.gif")
document.mswls.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/mouse_standard.jpg";
if (document.wireless.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/wireless_down.gif")
document.mswls.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/mouse_wireless.jpg";
}Code: Select all
function outMouseMon(){
if (document.none_mk.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/none_selected.gif")
document.monit.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/monitor_19.jpg";
if (document.19viewsonic.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/19_down.gif")
document.monit.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/monitor_19.jpg";
if (document.22viewsonic.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/22_down.gif")
document.monit.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/monitor_22.jpg";
if (document.22VXeco.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/22_VXeco_down.gif")
document.monit.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/monitor_22vx.jpg";
if (document.24VXeco.src == "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/24_VXeco_down.gif")
document.monit.src = "http://localhost/NE%20Websmith%20Site/Carbon_Footprint/purchase/images/xconfiguration/monitor_24vx.jpg";
}
Any idea what I'm missing?
Thanks, denewey