日期:2014-05-17 浏览次数:20764 次
<!doctype>
<html>
<head>
<style type="text/css">
#canvas1{width:200px;height:200px;}
</style>
<script type="text/javascript">
function A(){
var canvas=document.getElementById('canvas1');
var context=canvas.getContext('2d');
context.moveTo(20,20);
context.lineTo(120,20);
context.lineTo(120,120);
context.lineWidth=2;
context.stroke();
}
</script>
</head>
<body onload="A()">
<canvas id="canvas1" width="200px" height="200px"/>
</body>
</html>