PDA

View Full Version : OnMouseOver, on a <img> which runs a javascript


Cryton
01-06-2003, 09:54 PM
Hi all,

this may be a dumb question, but I've been banging my head against my monitor for a while over this, then forgot about it, but now I re-remembered and so I thought I'd ask here :)

I have a small picture. When it is clicked on, it opens up a new browser window (with no nav buttons or anything, just a title and a vertical scroller).

The code is shown below:

<img src="WebPics/Status_Info.gif" width="12" height="12" border="0" align="absmiddle" title="Click to read about the Circuit Training class" onClick="MM_openBrWindow('FitnessClasses_CircuitTraining .htm','','scrollbars=yes,width=350,height=400')">

While this works perfectly, when the user hovers their mouse over the image, the mouse pointer does not change to the standard finger (indicating a clickable link); it stays as the standard arrow.

How can I make the mouse pointer change to the clicking-finger when it hovers over my image pic which my java script hangs off?

Thanks for any help
Steve/Cryton

beetle
01-06-2003, 09:59 PM
Well, this actually doesn't require any javascript at all!

<img style="cursor:pointer">

or, in your example

<img src="WebPics/Status_Info.gif" width="12" height="12" border="0" align="absmiddle" title="Click to read about the Circuit Training class" onClick="MM_openBrWindow('FitnessClasses_CircuitTraining .htm','','scrollbars=yes,width=350,height=400')" style="cursor:pointer">

scroots
01-06-2003, 10:03 PM
change it to


<A HREF="#" onClick="MM_openBrWindow('FitnessClasses_CircuitTraining .htm','','scrollbars=yes,width=350,height=400')">
<img src="WebPics/Status_Info.gif" width="12" height="12" border="0" align="absmiddle" title="Click to read about the Circuit Training class" onClick="X">
</A>


scroots

Cryton
01-06-2003, 10:04 PM
Thanks for the quick replys! - Well appreciated, both of you.
[Edit because scroots popped a reply in whilst I was replying to beetle]

beetle
01-06-2003, 10:30 PM
Or, better yet, so you still have links that degrade (for non-javascript users, whomever they may be) and are search-engine friendly<a href="FitnessClasses_CircuitTraining.htm" onClick="MM_openBrWindow(this.href,'','scrollbars=yes,width=350,height=400')">
<img src="WebPics/Status_Info.gif" width="12" height="12" border="0" align="absmiddle" title="Click to read about the Circuit Training class" onClick="X">
</a>

Borgtex
01-06-2003, 11:58 PM
beetle, I think that your code will not work as expected if you don't add return false after MM_openBrWindow. Also, what is onClick="X" in the img tag for?

<a href="FitnessClasses_CircuitTraining.htm" onClick="MM_openBrWindow(this.href,'','scrollbars=yes,width=350,height=400');return false">
<img src="WebPics/Status_Info.gif" width="12" height="12" border="0" align="absmiddle" title="Click to read about the Circuit Training class">
</a>

beetle
01-07-2003, 12:32 AM
Originally posted by Borgtex
beetle, I think that your code will not work as expected if you don't add return false after MM_openBrWindow. Also, what is onClick="X" in the img tag for? Good question, we'd have to ask scroots, I copied/pasted his code. Didn't notice it there.

And yes, you're right about the return false; I replied in haste and should not have.

scroots
01-07-2003, 06:12 PM
its my mistake by copy, paste n cut keys malfunction
the code should be

<A HREF="#" onClick="MM_openBrWindow('FitnessClasses_CircuitTraining .htm','','scrollbars=yes,width=350,height=400')">
<img src="WebPics/Status_Info.gif" width="12" height="12" border="0" align="absmiddle" title="Click to read about the Circuit Training class">
</A>


scroots