Jump to content

[SOLVED] onMouseover event handling on an image


paul2463

Recommended Posts

this might seem a simple question, but never the less I dont know the answer, hence the stupid question...enough drivel there then..

 

here is the question, to prevent email harvesting on my scouting website I have written a small javascript  function that re-creates the mailto function and replaces the mailto part of the html page, this is the new html part of the page ( no function listing because it works perfectly)

 

<p><strong>For more information click <img src="images/Email-Logo.gif" alt="Email" width="100" height="71" border="0" onclick="emailForm('info')" /></strong></p>

 

my question is this, because the "mailto" function or "a href" function I have lost the mouse cursor changing to a hand on the image as it calls a function now. is there a simple way I can get that hand cursor back onMouseOver??

I'm a little new to CSS files so the formatting might be a little bit off but this should do the trick for you

 

p.img {

cursor: pointer;

}

 

put that into a .css file (assuming you don't have one) and add

<link rel="stylesheet" type="text/css" href="YOURCSSFILEHERE" />

 

to the head section of your site.

 

little reading for you

http://www.w3schools.com/css/pr_class_cursor.asp

grr time limit on edit post passed while typing edit

 

*EDIT*

forgot that would change the cursor to a hand for every image you have inside a <p> tag instead you could go like this

CSS file

#mailto {
cursor: pointer;
}

 

and for your img tag i think

<img id='mailto' src='images/Email-Logo.gif"

and if that does not work you can throw it into the <p> tag

<p id='mailto'>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.