<!DOCTYPE html> <html> <script type="text/javascript"> window.onload = function(){ var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); if(context){ context.beginPath(); context.moveTo(100,100); context.lineTo(700,700); context.lineTo(100,700); context.lineTo(100,100); context.closePath(); context.lineWidth = 5; context.strokeStyle = "red"; context.stroke(); context.beginPath(); context.moveTo(200,100); context.lineTo(700,600); context.closePath(); context.strokeStyle = "black"; context.stroke(); }else{ alert('当前浏览器不支持Canvas,请更换浏览器后再试'); } } </script> <body> <canvas id="canvas" width="1024" height="768" style="border:1px solid #aaa;display:block;margin:0 auto;"> 当前浏览器不支持Canvas,请更换浏览器后再试 </canvas> </body> </html>
跌落尘层的王者
2014-10-19
0 回答
举报
0/150
提交
取消