Current location: Hot Scripts Forums » General Web Coding » JavaScript » mouse click position on the image


mouse click position on the image

Reply
  #1 (permalink)  
Old 10-21-05, 03:31 AM
mirzao mirzao is offline
New Member
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
mouse click position on the image

How can I capture mouse click position on the image, and draw a little arrow on the image?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-24-05, 04:25 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
I think the easiest way to do this is to catch the onclick event from the image and then place an image of the arrow on top of it. (A gif with transparent background)
Code:
function placeImage(event){
 var X=event.clientX,Y=event.clientY 
 var img=document.getElementById('id_of_arrow_img')
 img.style.left=X
 img.style.top=Y
}
You might need to change to a different event.property if the position isn't correct. I haven't tested this script and I forgot which property works best.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
click in image then export to excel angela ASP 4 09-02-10 06:55 AM
Pop up on mouse click xxvatarxx JavaScript 0 08-02-05 02:42 PM
If You Can Click Your Mouse I GUARANTEE You'll Make It On Google!" DPR001 General Advertisements 0 04-14-05 02:51 AM
Keypress mimic mouse click tim8w Visual Basic 1 12-07-04 02:55 PM
how to draw an image inside a table? davidklonski HTML/XHTML/XML 2 07-06-04 11:27 AM


All times are GMT -5. The time now is 07:31 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.