我只是想用下面的代码在我的浏览器中创建一个画布:
<!DOCTYPE html>
<html lang="eng">
<head>
<title<abc</title>
<script type="text/javascript">
window.onload=canvasApp();
function canvasApp()
{
var canvas=document.getElementById("one");
if(!canvas||!canvas.getContext)
return;
}
</script>
<meta charset="utf-8">
<body>
<canvas id="one" width="400" height="500">
Your browser doesn't support canvas
</canvas>
</body>
</html>
为什么我在下面的代码行中使用canvas=null
var canvas=document.getElementById("one");
(我使用的是最新版本的chrome和firefox)
发布于 2012-08-18 23:41:28
您的HTML有些不尽如人意。
让W3C Validator试一试。现在它报告了7个错误和4个警告。
https://stackoverflow.com/questions/12016659
复制相似问题