Mozilla与IE在事件模型上略有差异
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="Seagle.K">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
var ie = window.navigator.appVersion.indexOf('MSIE')==-1?false:true;
window.document.onmousedown = function(e)
{
var e = ie?window.event:e;
var b = ie?e.button:e.which;
if (b == 1)
{
alert("Left Button");
}
}
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="Seagle.K">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
var ie = window.navigator.appVersion.indexOf('MSIE')==-1?false:true;
window.document.onmousedown = function(e)
{
var e = ie?window.event:e;
var b = ie?e.button:e.which;
if (b == 1)
{
alert("Left Button");
}
}
</script>
</head>
<body>
</body>
</html>