canvas中二维绘图环境对象获取的语句是哪项?假设canvas为获取的canvas对象名。
A: var ctx=canvas.getContext("2d");
B: var canvas=document.getElementById("myCanvas");
C: var ctx=canvas.getContext("WebGL");
D: var ctx=canvas.getElementById("2d");
A: var ctx=canvas.getContext("2d");
B: var canvas=document.getElementById("myCanvas");
C: var ctx=canvas.getContext("WebGL");
D: var ctx=canvas.getElementById("2d");
举一反三
- 画布(如下代码)创建后,怎样获取? [canvas id="myCanvas" width="200" height="100"] </canvas A: var canvas=document.getElementById('myCanvas'); B: var canvas=document.getElementsByName('myCanvas'); C: var canvas=document.getElementsById('myCanvas'); D: var canvas=document.getElementById('mycanvas');
- JS 文件通过哪个命令获取canvas对象? A: getWebGLContext(canvas) B: document.getElementById("example") C: canvas.getContext(2d) D: <canvas id="webgl" width="400" height="400"></canvas>
- JS 文件通过哪个命令获取canvas对象() A: getWebGLContext(canvas) B: document.getElementById(“example”) C: canvas.getContext(2d) D:
- 有这样一个canvas元素: <canvas id="myCanvas" width="200" height="100"></canvas> 如果有以下代码,则对代码的说明,不正确的是( ) <script type="text/javascript"> var c=document.getElementById("myCanvas"); var cxt=c.getContext("2d"); cxt.fillRect(0,0,100,50); </script>
- canvas绘图是借助于javascript脚本通过( )方法进行图像绘制 A: getElementById() B: getContext("2d") C: fillRect( D: strokeRect()