<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
body{background-color:black;}
#c1{ background-color:white;}
span{background-color:white;}
</style>
<script type="text/javascript">
window.onload = function()
{
var oC= document.getElementById("c1");
var oGC = oC.getContext("2d");
/*
oGC.fillRect(10,30 ,100, 100); /* 填充(默认黑色填充改为红色)的实心方块:参数:left top width height */
oGC.strokeRect(200,30 ,100, 100); /* 带边框(默认黑色边框)的空心方块:参数:left top width height */
*/
oGC.fillRect(10, 30, 100, 100); /* 填充(默认黑色填充)的实心方块:参数:left top width height */
// oGC.strokeRect(10.5,30.5 ,100, 100); /* 带边框(默认黑色边框)的空心方块:参数:left top width height */
};
</script>
</head>
<body>
<canvas id="c1" width="400" height="400">
<span>不支持canvas标签的浏览器。</span>
</canvas> <!-- canvas :默认 宽300高150 -->
</body>
</html>