HTML 5 getContext not working?

Manmohit Sehgal

New member
Hi everyone, i am trying my first html 5 simple canvas example but it doesnot seem to work,
everything works perfectly fine until it comes to getContext, after ('canvas').getContext; getContext doesnot appear in the menu, how should i fix this???


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>DIVE INTO HTML 5</title>
<script src="modernizr-1.7.min.js" type="text/javascript"></script>
</head>
<body>
<canvas id="myCanvas">
</canvas>
<script src="modernizr-1.7.min.js" type="text/javascript">
if (Modernizr.canvas) {
// lets draw somthing
}
else {
// nothing apperas to be drawn
}
function supports_canvas() {
return !!document.
createElement('canvas').
getContext; <--- i wrote this down by myself to show where it should occur but, it doesnot occur anywhere in the menu. how to fix that?
}
</script>
</body>
</html>
 
Back
Top