Unknown runtime error test page

67 views
Skip to first unread message

radu

unread,
Jan 5, 2010, 7:55:52 AM1/5/10
to google-excanvas
Here's a test page (jquery 1.3.2 & excanvas 3). If you click "GO"
you'll see the error : "Unknown runtime error".


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="excanvas.js?v=3"></script>
</head>

<body>

<script>

function fa(){
var div = document.createElement("div");
div.id = "div";
div.innerHTML = "<div id='results'>R:<canvas id='canvas' width='200'
height='200'></canvas><canvas id='canvas2' width='200' height='200'></
canvas></div>";
$("#box")[0].appendChild(div);

var c = $("#canvas")[0];
alert(c);

if (!c.getContext){
c = G_vmlCanvasManager.initElement(c);
}

var ctx = c.getContext("2d");
ctx.strokeStyle = 'black';
ctx.lineWidth = 1;
ctx.beginPath();
ctx.moveTo(0,0);
ctx.lineTo(200,200);
ctx.closePath();
ctx.stroke();
}

</script>

<a href="#" onClick="fa()">GO</a>
<div id="box"></div>

</body>

</html>

radu

unread,
Jan 5, 2010, 8:01:24 AM1/5/10
to google-excanvas
PS: If I create the canvas with createElement it's ok, the problem is
when you put the canvases in a div with innerHTML: div.innerHTML =
"<canvas ...></canvas>"
Reply all
Reply to author
Forward
0 new messages