How to Trigger this Javascript Function
<pre><code>&lt;script type="text/javascript"&gt;
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMousePos;
// Temporary variables to hold mouse x-y pos.s
var tempX = 30;
var tempY = 30;

function getMousePos(e) {
  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/correct negative values 
  if (tempX &lt; 0){tempX = 0}
  if (tempY &lt; 0){tempY = 0}  

  // show the position values in the form
  document.MouseDisplay.MouseX.value = tempX;
  document.MouseDisplay.MouseY.value = tempY;
  return true;
}

// execute function
if (tempY &lt; 30) {
 alert('tempY is found to be less than 30');
}

&lt;/script&gt;
</code></pre>

<p>I found this code at hotscript and codelifter <a href="http://www.codelifter.com/main/javascript/capturemouseposition1.html" rel="nofollow">http://www.codelifter.com/main/javascript/capturemouseposition1.html</a>, it was from an old thread but I believe it's got what I need to achieve. I want to execute a function whenever the mouse Y position is less than 30.</p>

<p>I'm a beginner at programming, hope that I can slowly learn from samples here.</p>

<p>My question is, why is the alert command not triggered? What am I missing here. I did a simple button to call the function it works tho.</p>

<pre><code>&lt;script type="text/javascript"&gt;
function myFunction() {
alert('tempY is found to be less than 30');
}
&lt;/script&gt;
</code></pre>
