Status
Not open for further replies.
9 comments
In the head part do something like
Code:
var isFirstMouseOver = true;

function mouseOverHandler(elm)
{
    if (isFirstMouseOver)
    {
        isFirstMouseOver = false;
        // do stuff...
    }
    else
    {
        // not the 1st time...
    }
}
And then in the HTML
Code:
<a href="#" onmouseover="mouseOverHandler(this); return false;">foo</a>
 
or, how about...

Code:
<a href="" onmouseover="alert('Hello!');this.onmouseover='';">Link</a>

That will create a mouse-over effect indeed, but it will work the second and third etc time too. And TS specifically asked for a snippet that works only on the first mouse-over event :)

Otherwise, it works yes :)
 
Elj's example should work too. Although I'm not 100% sure if all browser like that sort of tricks. But IMO code should be self explaining. Like mine.

* Hyperz' ego just went 1UP XD
 
Code:
<a href=""><img src="images.png" alt="anything" onmouseover="this.src='image.png';" onmouseout="this.src='images.png';" /></a>
 
Status
Not open for further replies.
Back
Top