Javascript Event based on Firefox and IE

July 12, 2010 | In: javascript

In this post I simply showing how to find the cursor position in the window screen.

<script type="text/javascript">
		function showPositionOnClick(evt)
		{
			var e = (window.event) ? window.event : evt;
			alert(e.clientX);
		}
	</script>
<input type="button" value="Click here" onclick="showPositionOnClick(event);" />

When user click on this button an event fired and it shows the position of the cursor. This code is running is both Firefox and IE..