Javascript: How to prevent an href="" on a onMouseOver event of an image to do nothing when the user clicks on the image?

I have this javascript call on a onMouseOver event of an image
<a href="" onMouseOver="vShowThis(1);" onMouseOut="vHideThis();return true;">
      <img border="0" src="images/small/que.gif" width="19" height="19">
</a>

How do I prevent the click to open a "" blank page?
LVL 11
AkisCAsked:
Who is Participating?
 
Michel PlungjanConnect With a Mentor IT ExpertCommented:
<a href="#"  onClick="return false"
onMouseOver="vShowThis(0);" onMouseOut="vHideThis();return true;"><img
border="0" src="images/small/que.gif" width="19" height="19"></a>

(also loose the whitespace if you have underline)
0
 
Ashutosh VyasFounder, InitQubeCommented:
If you do not want user to navigate anywhere when he clicks the image, why do you need anchor tag on it then?
0
 
AkisCAuthor Commented:
My javascript expirience counts some 20 days.
I read on the internet that if you want to show shomething when the mouse is over an image then you have to use the code like above... I copy/pasted it from another page

Is there a better way to handle a onMouse even on this image?
<img border="0" src="images/small/que.gif" width="19" height="19">

Thank you

0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
Michel PlungjanIT ExpertCommented:
And the reason to put it in a link is
1. screen readers (you would want an ALT on the image or a TITLE on the link)
2. automatic hand/pointer when the mouse is hovering
3. backwards compatibility with old browsers or new pared down browsers on smartphones for example
0
 
AkisCAuthor Commented:
Hi mplungjan
Did I award 500x4? This was my intention
I was on the phone and clicked {ok} without paying attention.
Please tell me?
0
 
Michel PlungjanIT ExpertCommented:
Yes, thanks
0
 
AkisCAuthor Commented:
Your help is much appreciated!
I thank you for your precious time spend for my problem
0
 
Michel PlungjanIT ExpertCommented:
You are welcome
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.