Nov 27, 2001 #1 Serban Programmer Joined Sep 25, 2001 Messages 36 Location RO How can I find the X and Y values in the onClick event of a img tag? Thanks
Nov 27, 2001 #2 dawnb Programmer Joined Jul 20, 2001 Messages 8 Location GB Perhaps you could use the fact that if image maps will send x and y co-ordinates in the URL. E.G <a href="test.htm"><img src=".gif" border="0" ismap></a> <script language="JavaScript"><!-- str = location.search; if (str != "" { commaloc = str.indexOf("," document.write("<p>X:" + str.substring(1, commaloc)); document.write("<p>Y:" + str.substring(commaloc+1, str.length)); } //--></script> dawn@soholondon.com Upvote 0 Downvote
Perhaps you could use the fact that if image maps will send x and y co-ordinates in the URL. E.G <a href="test.htm"><img src=".gif" border="0" ismap></a> <script language="JavaScript"><!-- str = location.search; if (str != "" { commaloc = str.indexOf("," document.write("<p>X:" + str.substring(1, commaloc)); document.write("<p>Y:" + str.substring(commaloc+1, str.length)); } //--></script> dawn@soholondon.com