A few things...
First not sure why you disabled BBcode, the post looks fine with it enabled and it's much more readable this way.
Second people need to stop referencing elements as tags.
<element attribute="value" />
<tag_opening></tag_closing>
When referencing HTML elements please use the word element.
Third I deleted the double post for you.
Fourth avoid using double quotes in JavaScript.
Fifth don't put script elements in the body element, it's really bad practices and encourages things like document.write and innerHTML among other things which are horribly unreliable.
Sixth end your JavaScript lines with semi-colons, being strict with your code will pay out in the end.
Lastly I don't know much about Canvas though I have cleaned up the document for you. Save this to a file with an
xhtml extension...
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Canvas Example</title>
<script type="text/javascript">
//<![CDATA[
var c=document.getElementById('example');
var cxt=c.getContext('2d');
var img=new Image();
img.src='http://www.whatwg.org/images/logo';
cxt.drawImage(img,20,0);
//]]>
</script>
</head>
<body>
<h1>Canvas Example 1</h1>
<div>
<img src="helloi.gif" width="133" height="100" />
<canvas id="example" width="400" height="100" style="border:3px solid #000000;">
Your browser does not support the canvas element.
</canvas>
</div>
</body>
</html>
XHTML is stricter but if you screw up your code it'll be much easier to fix your code.
As far as doing this in general you'll need someone else who knows how to work with Canvas.
I tested this in Safari since Apple came up with the canvas element (I think offhand?) and the developer console was spawning some errors so start with that.