Canvas中用jQuery获取到的对象无法使用getContext

Posted tomatofjy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Canvas中用jQuery获取到的对象无法使用getContext相关的知识,希望对你有一定的参考价值。

window.onload=function(){
    var canvas=document.getElementById("draw");
    //$("#draw")不可用
    var context=canvas.getContext("2d");
    context.moveTo(10,10);
    context.lineTo(100,100);
    context.stroke();
}

 

以上是关于Canvas中用jQuery获取到的对象无法使用getContext的主要内容,如果未能解决你的问题,请参考以下文章