Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mouse position in a picture

Status
Not open for further replies.

Serban

Programmer
Sep 25, 2001
36
RO
How can I find the X and Y values in the onClick event of a img tag?

Thanks
 
Perhaps you could use the fact that if image maps will send x and y co-ordinates in the URL. E.G

<a href=&quot;test.htm&quot;><img src=&quot;.gif&quot; border=&quot;0&quot; ismap></a>

<script language=&quot;JavaScript&quot;><!--
str = location.search;
if (str != &quot;&quot;)
{
commaloc = str.indexOf(&quot;,&quot;);
document.write(&quot;<p>X:&quot; + str.substring(1, commaloc));
document.write(&quot;<p>Y:&quot; + str.substring(commaloc+1, str.length));
}
//--></script> dawn@soholondon.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top