源代码
<script>
window.onload=function(){
c=document.getElementById("tu");
var p= c.getContext("2d");
var p= c.getContext("2d");
function a(e){
c.mousedown(function(e){
p.moveTo(e.clientX-10,e.clientY-10);
c.onmousemove=function(e){
p.lineTo(e.screenX,e.screenY-50);
p.stroke();
}
}
}
}
</script>
<body>
<canvas width="900" height="600" id="tu"></canvas>
</body>
花括号不匹配,仔细检查下,后括号是不是多了一个。
我在js中为一个已经定义的数组重新定义新的一个维度的数组时,调试器这样报错
SyntaxError: Unexpected token [”" title="关于js中的“Uncaught SyntaxError: Unexpected token [”" style="margin:0px; padding:0px; border:0px; list-style:none">
......
答案就在这里:关于js中的“Uncaught SyntaxError: Unexpected token
----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。
c.mousedown(function(e){
==>
c.onmousedown=function(e){