<script language="JavaScript" type="text/JavaScript">
function test1 (message, e) {
alert(message + e.clientX);
alert(message + e.screenX);
}
</script>
<p onclick="test1('X坐标是', event)">点击这里!</p>
function test1 (message, e) {
alert(message + e.clientX);
alert(message + e.screenX);
}
</script>
<p onclick="test1('X坐标是', event)">点击这里!</p>
where:eventType is the type of the event you want to listen to. Do not include the "on" prefix. Examples: "mouseover", "click", "mouseout", "mouseup", and "mousedown".
functionCall is the function you want to execute when the event is detected. This is the actual function reference and not a string, so don't include the function name in quotes. If you need to pass parameters to the function, simply pass them in this call, as functionName(param1, param2).
downBool is a Boolean variable (true or false) that tells the listener on which phase to intercept the event. A true value asks the listener to intercept the event on its way down from the browser window object to its target object (capture phase). A false value signals the listener to intercept it on its way up from the target object to the window object (bubbling phase).
function test1 (e) {
test2("X坐标是", e);
}
function test2 (message, e) {
alert(message + e.clientX);
}
</script>
<p onClick="test1(event)">点击这里!</p>