日期:2014-05-16 浏览次数:20470 次
<canvas id="cav" style="border:solid 1px #000;" width="600" height="400"></canvas>
<canvas id="cav" style="border:solid 1px #000;width:600px;height:400px;"></canvas>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test</title>
</head>
<body>
<canvas id="cav1" style="border:solid 1px #000;" width="600" height="300"></canvas>
<br/><br/>
<canvas id="cav2" style="border:solid 1px #000;width:600px;height:300px;"></canvas>
<script type="text/javascript">
//正常
var can = document.getElementById("cav1");
var ctx=can.getContext('2d');
ctx.fillRect(10,10,200,100);
ctx.stroke();
//2倍
can = document.getElementById("cav2");
ctx=can.getContext('2d');
ctx.fillRect(10,10,200,100);
ctx.stroke();
</script>
</body>
</html>