views:

229

answers:

1

Basically I have a bunch of IMG tags wrapped in a bunch of divs, and some javascript to make them do rollovers. The page functions beautifully in IE and in Firefox, but Safari gives:

"TypeError: Result of expression 'ImageNavigateForum' [undefined] is not an object."

Where ImageNavigateForum is the ID tag of the 'img'. (a simmelar error occurs when rolling over any 'img' on the page.)

Neccisarry code follows:

<div id="NavigateForum" onmouseover="ImageNavigateForum.style.visibility='visible'" onmouseout="ImageNavigateForum.style.visibility='hidden'">
<a href="http://www.dmt-nexus.com/forum"&gt;
 <img id="ImageNavigateForum" src="images\NavigateForum.jpg" class="hidden" alt="" />
</a>

there is a matching #NavigateForum entry in style.css

Somone knows the answer to this! Thankyou mysterious internet coders! Shoe

+2  A: 
onmouseover="ImageNavigateForum (…)

should be

onmouseover="document.getElementById('ImageNavigateForum') (…)

I don't even know why yours works on FX and IE.

Edit: Same goes with other places where you want to get a reference to an element by it's id (like the onmouseout)

Jeffrey Aylesworth
In IE <.. id="foo" ..>.. will place a property foo on the global object, Safari and Firefox both ostensibly mimick this behaviour now, maybe Safari doesn't do it for images?
olliej
Ah, I was wondering if that was an extra "feature" to make ids more like names
Jeffrey Aylesworth