IE below draw line
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<style type= "Text/css" >
v/:* {behavior:url (#default #vml);}
</style>
<body>
<v:line
From= ' 200,200 '
To= ' 300,100 '
style= ' Position:absolute;z-index:8 ' >
</v:line>
</body>
<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>
FF Drawing Line
Copy Code code as follows:
<title>a Canvas fillrect, strokerect and Clearrect example</title>
<meta name= "Dc.creator" content= "Kamiel martinet, http://www.martinet.nl/" >
<meta name= "Dc.publisher" content= "Mozilla Developer Center, http://developer.mozilla.org" >
<script type= "Text/javascript" >
function Drawshape () {
Get the canvas element using the DOM
var canvas = document.getElementById (' tutorial ');
Make sure we don ' t execute 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 (' Your need Safari or Firefox 1.5+ to the ');
}
}
</script>
<style type= "Text/css" >
</style>
<body onload= "Drawshape ();" >
<div>
<canvas id= "Tutorial" width= "height=" ></canvas>
</div>
</body>