javascript中如何获得事件的引用?

来源:百度知道 编辑:UC知道 时间:2024/06/06 00:24:05
javascript中如何获得事件的引用?
我写了下面的一段代码,但是并没有效果
<html>
<head>
<title>事件绑定</title>
<script>
/*function eventHandle()
{
var oBtn = document.getElementById("btn");
oBtn.onclick = function (){alert("Button pressed...");};
}*/

function recordXY(e)
{
e = e || window.event;
//var txtArea = document.getElementById("textarea");
//txtArea.value += "(" + e.clientX + ")" + "(" + e.clientY + ")";
alert(e.type);
}
window.onload = handle;
</script>
</head>
<body>
<div><input type = "button" id = "btn" value = "Test Event"></input></div>
<div><textarea rows = "5" cols = "30" id = "textarea"></textarea></div>
<di

把这句里的
<div style = "background-color : lightgreen; width : 200px; height: 20px"
onmouseover = "recordXY(e)">// 这里

改成

onmouseover = "recordXY(event)

请问一下handle在哪?