我想定义一个尺度变量,其中图像根据其值进行动态缩放。我不认为表达式* 100正在评估,因为没有大小的差异。哪里不对。评价函数参数内的java脚本表达式
<html>
<body onload="draw();">
<canvas id="canvas" width="150" height="150"></canvas>
</body>
<script type="application/javascript">
function draw() {
var canvas = document.getElementById("canvas");
if (canvas.getContext) {
var ctx = canvas.getContext("2d");
var s = 10000;
ctx.fillStyle = "rgba(0, 0, 200, 0.1)";
ctx.fillRect (0, 0, s*100, s*100);
}
}
</script>
</html>
谢谢..不错的例子:-) – bsr 2011-04-21 21:24:21