MiLLion Posted August 26, 2007 Share Posted August 26, 2007 Hi, i want to find the cursorposition when you click on an image, then i want AJAX to submit to a database... I've been trying the following: <script language="javascript"> function getDetails(obj){ clickX = window.event.x-obj.offsetLeft; clickY = window.event.y-obj.offsetTop; alert('X: ' + clickX + ' Y: ' + clickY + '.'); } </script> and <script language="javascript"> var tempX = 0 var tempY = 0 function getDetails(obj){ if (IE) { // grab the x-y pos.s if browser is IE tempX = event.clientX + document.body.scrollLeft tempY = event.clientY + document.body.scrollTop } else { // grab the x-y pos.s if browser is NS tempX = e.pageX tempY = e.pageY } // catch possible negative values in NS4 if (tempX < 0){tempX = 0} if (tempY < 0){tempY = 0} alert('X: ' + tempX + ' Y: ' + tempY + '.'); } </script> but i don't know how to process it to a database! Any suggestions? Thanks Link to comment https://forums.phpfreaks.com/topic/66770-get-cursor-position/ Share on other sites More sharing options...
ReDucTor Posted August 28, 2007 Share Posted August 28, 2007 Checkout the ISMAP attribute <A HREF="yourscript.php?params="><IMG SRC="imap.gif" ISMAP></A> Link to comment https://forums.phpfreaks.com/topic/66770-get-cursor-position/#findComment-335987 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.