Return to Snippet

Revision: 44826
at April 19, 2011 18:57 by onblur


Initial Code
function mouseDown(nsEvent) {
	// Support Mozilla browsers that use event passing to functions
	var theEvent = nsEvent ? nsEvent : window.event;
	var locString = "Screen X = " + theEvent.screenX + " Client X = " + theEvent.clientX + "\n";
	locString += "Screen Y = " + theEvent.screenY + " Client Y = " + theEvent.clientY + "\n";
	if ( theEvent.altKey ) {
		locString += " - Alt key pressed";
	}
	console.log(locString);
}

Initial URL


Initial Description


Initial Title
Cross-browser javascript event capture

Initial Tags
object, event

Initial Language
JavaScript