Nov 27, 2001 #1 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
Nov 27, 2001 #2 dawnb Programmer Jul 20, 2001 8 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