javascript关于IE和火狐处理event处理数据的问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<!--
javascript关于IE和火狐处理event处理数据的问题
经过此处理,在ie和火狐中event对象都能创建对象
-->
</head>
<body>
<div id="div1" style="width:400px; height:300px; background-color:#03C"></div>
<script language="javascript" type="text/javascript">
//当div的onmousemove属性触发是调用getPoint函数
document.getElementById("div1").onmousemove=getPoint;
function getPoint(evt){
//当形参evt为空的话就会执行||后边的window.event;
var evt1=evt||window.event;
document.getElementById("div1").innerHTML=evt1.clientX+","+evt1.clientY;
}
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<!--
javascript关于IE和火狐处理event处理数据的问题
经过此处理,在ie和火狐中event对象都能创建对象
-->
</head>
<body>
<div id="div1" style="width:400px; height:300px; background-color:#03C"></div>
<script language="javascript" type="text/javascript">
//当div的onmousemove属性触发是调用getPoint函数
document.getElementById("div1").onmousemove=getPoint;
function getPoint(evt){
//当形参evt为空的话就会执行||后边的window.event;
var evt1=evt||window.event;
document.getElementById("div1").innerHTML=evt1.clientX+","+evt1.clientY;
}
</script>
</body>
</html>