Version compl�te: jsB@nk » Pointer » Détection de position de souris
URL: https://www.javascriptbank.com/detecting-mouse-position.html
C'est un moyen facile de déterminer la position de la souris sur une page Web. Cliquez n'importe où sur la page et les coordonnées seront affichées.
Version compl�te: jsB@nk » Pointer » Détection de position de souris
URL: https://www.javascriptbank.com/detecting-mouse-position.html
<script type="text/javascript">// Created by: Roy Marchand | http://www.expertsrt.comfunction showit() { document.forms['theform'].xcoord.value=event.x; document.getElementById('spanx').innerHTML='x = '+event.x; document.forms.theform.ycoord.value=event.y; document.getElementById('spany').innerHTML='y = '+event.y;}function showitMOZ(e) { document.forms['theform'].xcoord.value=e.pageX; document.getElementById('spanx').innerHTML='x = '+e.pageX; document.getElementById('spany').innerHTML='y = '+e.pageY; document.forms.theform.ycoord.value=e.pageY;}if (!document.all) { window.captureEvents(Event.CLICK); window.onclick=showitMOZ;} else { document.onclick=showit;}</script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<h4>You can store them in form fields</h4><form name="theform">x = <input name="xcoord" type="text" readonly size="5"> y = <input name="ycoord" type="text" readonly size="5"></form><p><h4>or as plain text</h4><span id="spanx"> </span> <span id="spany"> </span><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->