IE下画线
<script>
var R =function(){};
R.prototype.createLine = function (startX,startY,endX,endY){
var le = document.createElement( "<v:line><v:line>" );
le.from = startX + ',' + startY ;
le.to = endX + ',' + endY ;
le.strokecolor= "red" ;
le.strokeweight= "1pt" ;
return le;
}
var d =new R();
document.body.appendChild(d.createLine(1,1,200,100));
</script>
// Make sure we don't execute when canvas isn't supported
if (canvas.getContext){
// use getContext to use the canvas for drawing
var ctx = canvas.getContext('2d');
// Draw shapes
ctx.fillRect(25,25,100,100);
ctx.clearRect(45,45,60,60);
ctx.strokeRect(50,50,50,50);
ctx.beginPath();
ctx.moveTo(100,100);
ctx.lineTo(200,250);
ctx.lineTo(50,250);
ctx.closePath();
ctx.stroke();
} else {
alert('You need Safari or Firefox 1.5+ to see this demo.');
}
}
</script>
<style type="text/css">
</style>
</head>
<body onload="drawShape();">
<div>
<canvas id="tutorial" width="400" height="400"></canvas>
</div>
</body>
</html>
新闻热点
疑难解答