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??

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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'>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.