JS 文件通过哪个命令获取canvas对象?
A: getWebGLContext(canvas)
B: document.getElementById("example")
C: canvas.getContext(2d)
D: <canvas id="webgl" width="400" height="400"></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为获取的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");
- 画布(如下代码)创建后,怎样获取? [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');
- HTML5画布API中创建一个宽度为200px、高度为50px的画布,以下哪句代码正确?( )。 A: <;canvas id=”myCanvas” w=”200” h=”50”>;<;/canvas>; B: <;canvas id=”myCanvas” w=”200px” h=”50px”>;<;/canvas>; C: <;canvas id=”myCanvas” width=”200” height=”50”>;<;/canvas>; D: <;canvas id=”myCanvas” width=”200px” height=”50px”>;<;/canvas>;
- 1.2.1 JS 文件通过哪个命令获取canvas对象?