Sunday, 11 August 2013

trouble in using HTML5 canvas

trouble in using HTML5 canvas

I'm new in using HTML5. I wonder why the following code can't show a
rectangle on the screen?
<!DOCTYPE HTML>
<html>
<head>
<title>WebServer Test</title>
<script type="text/javascript"
src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var userviewcanvas = $("userViewerCanvas");
var userviewcontext = userviewcanvas.getContext("2d");
userviewcontext.fillRect(40, 40, 100, 100);
});
</script>
</head>
<body>
<canvas id="userViewerCanvas" width="200" height="300">this is
canvas</canvas>
<div><span id="message"> </span> </div>
<div><span id="stream"></span></div>
</body>
</html>

No comments:

Post a Comment