<html>
<head>
<script>
function draw() {
var canvas = document.getElementById('draw');
if (canvas.getContext) {
var ctx = canvas.getContext('2d');
for (i=0,i<=700,i+=10){
ctx.beginPath();
ctx.moveTo(i,700-i);
ctx.lineTo(700-i,i);
ctx.stroke();
}
} else {
document.write("Hey idiot, whhich idiot browser you are using? No IE clan here!");
}
}
</script>
</head>
<body onload="draw();">
<canvas id="draw" width="700" height="700"></canvas>
</body></html>
Can anyone tell me what the problem is that this simple code is not working? ………………………..
Because your for loop is using commas, it needs semicolons:
for (i=0;i<=700;i+=10){Also this is not OK:
Don’t insult your users!