html5 canvas 画布的问题。请高手讲解。
<html><head><scripttype="text/javascript">functioncanvas_getCoordinates(e){x=e.client...
<html>
<head>
<script type="text/javascript">
function canvas_getCoordinates(e)
{
x=e.clientX;
y=e.clientY;
document.getElementById("xycoordinates").innerHTML="Coordinates: (" + x + "," + y + ")";
}
function canvas_clearCoordinates()
{
document.getElementById("xycoordinates").innerHTML="";
}
</script>
</head>
<body>
<div id="coordiv" style="float:left;width:199px;height:99px;border:1px solid #c3c3c3" onmousemove="canvas_getCoordinates(event)" onmouseout="canvas_clearCoordinates()">
</div>
<br />
<div id="xycoordinates"></div>
</body>
</html>
-------------------------------------------------------------
<scriptk中function canvas_getCoordinates(e)的(e)是代表事件的意思还是别的意思?如果是event的意思为何不能把e改成event?
onmousemove="canvas_getCoordinates(event)" 中event为何不能改成e? 展开
<head>
<script type="text/javascript">
function canvas_getCoordinates(e)
{
x=e.clientX;
y=e.clientY;
document.getElementById("xycoordinates").innerHTML="Coordinates: (" + x + "," + y + ")";
}
function canvas_clearCoordinates()
{
document.getElementById("xycoordinates").innerHTML="";
}
</script>
</head>
<body>
<div id="coordiv" style="float:left;width:199px;height:99px;border:1px solid #c3c3c3" onmousemove="canvas_getCoordinates(event)" onmouseout="canvas_clearCoordinates()">
</div>
<br />
<div id="xycoordinates"></div>
</body>
</html>
-------------------------------------------------------------
<scriptk中function canvas_getCoordinates(e)的(e)是代表事件的意思还是别的意思?如果是event的意思为何不能把e改成event?
onmousemove="canvas_getCoordinates(event)" 中event为何不能改成e? 展开
1个回答
2016-05-29
展开全部
function canvas_getCoordinates(e) 中的e只是函数的参数,没什么特别啊,我改了试了不管是event还是其他的abcd都无关紧要的。
至于event代表的是事件,一般因为兼容问题这样写:event = window.event||e;
至于event代表的是事件,一般因为兼容问题这样写:event = window.event||e;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询