问题描述
假设我想删除数字 <canvas id="myCanvas" width="400" height="400"
style="border:1px solid #ff0000;">
</canvas>
<br>
<p>Choose a Shape</p>
<select id="shapesId">
<option value="">Please select</option>
<option value="rectangle">rectangle</option>
<option value="circle">circle</option>
</select>
<input type=button value="DRAW" onclick="javascript:draw();">
<script>
function draw() {
var xvalue = document.getElementById("shapesId").options[document.getElementById("shapesId").selectedIndex].value;
if (xvalue=="rectangle") {
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.clearRect(0,400,400);
var ctx = c.getContext("2d");
//ctx.clearRect(0,canvas.width,canvas.height);
ctx.beginPath();
ctx.rect(20,20,150,100);
ctx.stroke();
}
if (xvalue=="circle") {
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.clearRect(0,400);
var ctx = c.getContext("2d");
//ctx.clearRect(0,canvas.height);
ctx.beginPath();
ctx.arc(95,50,40,2 * Math.PI);
ctx.stroke();
}
}
</script>
的最后一位。
为此,我使用代码 n
。
遗憾的是,这对大数字给出了错误的结果。
例如,int(n/10)
除以 n = 4474630975855204960
得到 10
。
这种行为的原因是什么?我该如何解决?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)