桃乐丝星空干红葡萄酒:一个问题,非常着急,javascript相关

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 13:03:39
window.setInterval("aa()",500)

这个aa() 函数里是不是不能包含 document.write()
但是我设计的这个里边必须要用到document.write() ,怎么办啊
怎么才能每隔一秒运行一次document.write()呢,

你的 write 写些什么东西呢。。? 最好用 innerHTML 或 innerText

不然页面给重写过了,方法就没效了。。!

<div id="maple">by richie214</div>
<script type="text/javascript">
function aa() {
document.getElementById("maple").innerHTML += Math.random() * 100
}
window.setInterval("aa()",500)
</script>