.innerHTMl的显示问题
在html页面里,有如下代码来显示数字
<script type="text/javascript">
var t = 3000;
var ctl_id1 = "numShow1";
var Num1 = 68052;
onload = function() {
Refresh();
setInterval("Refresh();", t);
}
function Refresh() {
var add = parseInt(Math.random()*4);
Num1 = Num1 + add;
document.getElementById(ctl_id1).innerHTMl = Num1;
}
</script>
放在htm界面里就失效了,请问高手们,应该怎样改才能让它显示?
------解决方案--------------------window.onload =function() {
Refresh();
}
function Refresh() {
var add = parseInt(Math.random()*4);
Num1 = Num1 + add;
document.getElementById(ctl_id1).innerHTML = Num1;
setInterval("Refresh()", t);
}
这个可以了 ,
------解决方案--------------------<script type="text/javascript">
var t = 3000;
var ctl_id1 = "numShow1";
var Num1 = 68052;
window.setInterval("Refresh()", t);
function Refresh() {
var add = parseInt(Math.random()*4);
Num1 = Num1 + add;
document.getElementById(ctl_id1).innerHTML = Num1;
}
</script> 这样也可以。