叫我瘋子
2016-05-17 19:55:19
window.onload=function(){ var Otxt=document.getElementById("txt"); var num=0; function timer(){ var m=setInterval(function(){ num++; location.reload(); Otxt.value="刷新次數(shù):"+num; },200); } timer(); };<html><body><input id="txt" type="text"></body></html>
4 回答

慕娘9282524
TA貢獻(xiàn)13條經(jīng)驗(yàn) 獲得超8個(gè)贊
<html>
<body>
<script>
window.onload=function(){
var Otxt=document.getElementById("txt");
var num=0;
function timer(){
var m=setInterval(function(){
num++;
Otxt.value="刷新次數(shù):"+num;
},200);
}
timer();
};
</script>
<input id="txt" type="text">
</body>
</html>
你確定不把js內(nèi)容 寫在<html>中 真的沒(méi)問(wèn)題嗎。
你確定不把js內(nèi)容 寫在<script>中 真的沒(méi)問(wèn)題嗎。
添加回答
舉報(bào)
0/150
提交
取消