shoe
shoe

Reputation: 11

Simple problem: Safari and CSS/Javascript Rollovers

Basically I have a bunch of <img> tags wrapped in a bunch of <div>'s, 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.)

Necessary code follows:

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

there is a matching #NavigateForum entry in style.css

Upvotes: 1

Views: 500

Answers (1)

Jeffrey Aylesworth
Jeffrey Aylesworth

Reputation: 8490

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)

Upvotes: 2

Related Questions