Sensing Events Anywhere on the Screen in DHTML


Please do not click there

The code is as shown below.

<HEAD>

<TITLE>Sensing Events Anywhere on the Screen</TITLE>

<SCRIPT LANGUAGE="JavaScript" SRC="../include/browser.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript">

function defaultEvents ()
{
	if (isNS4)
	{
		document.captureEvents (Event.MOUSEDOWN | Event.MOUSEUP);
	}
	if (isNS4 || isIE4)
	{
		document.onmousedown = errorOn;
		document.onmouseup = errorOff;
		dom = eval (docObj + '.errMess' + styleObj);
	}
}

function errorOn ()
{
	dom.visibility = "visible";
	return false;
}

function errorOff ()
{
	dom.visibility = "hidden";
	return false;
}

</SCRIPT>

<STYLE TYPE="text/css">
	#errMess { position: absolute; top: 30%; left: 40%; visibility: hidden; border: red 5pt solid; background-color: white; layer-background-color: white; z-index: 10; }
</STYLE>

</HEAD>

<BODY onLoad="defaultEvents();">

<A HREF="../dhtmlidx.html">Dynamic HTML Index</A><BR><BR>

<CENTER>
	<SPAN ID="errMess">Please do not click there</SPAN>
	<IMG SRC="../graphics/NGC1068.jpg" WIDTH="252" HEIGHT="252"> 
</CENTER>