this works in firefox but not in ie........pls tell me y

1 view
Skip to first unread message

harry

unread,
Jul 24, 2008, 8:52:02 AM7/24/08
to google-excanvas
<html>
<head>
<!-- saved from url=(0014)about:internet -->
<script type="text/javascript" src="excanvas.js"></script>
</head>
<body onload="initCanvas()">
<p>Use the Ctrl+MouseWheel to zoom in & out. </p>
<p>In IE 7, the lines will cross :(</p>
<canvas id="c" onclick="drawLine(event.clientX,event.clientY,0,0)">
</canvas>
<script language="Javascript">
var d
var canvas
var ctx
var count;

function initCanvas() {
canvas = document.getElementById("c");
ctx = canvas.getContext("2d")
ctx.lineWidth = "2";
ctx.strokeStyle = "black";
ctx.beginPath();
count=0
// draw two lines from the same point.
drawLine(100, 50, 50, 150)


}

function drawLine(x1, y1, x2, y2) {
if(count==0)
{
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);

//ctx.fill();
}
if(count>0)
{
ctx.lineTo(25, 35);
ctx.fill();

}
ctx.stroke();
count++;
}

</script>
</html>
Reply all
Reply to author
Forward
0 new messages