文章详情页
javascript - setInterval和document.write在IE浏览器下的冲突
浏览:117日期:2023-03-22 08:20:56
问题描述
function reload(){ alert('ce');}window.onload=function(){ alert('a'); setInterval('reload()',1000); document.write('aaa');};
如上,同时有 setInterval 和 document.write在其他极速浏览器,chrome内核浏览器里没有问题。但是在 IE11 浏览器里,setInterval 就会停止。怎么解决。谢谢。
问题解答
回答1:document.write会隐式调用document.open。这样会重构document,移除所有event事件和task。
可以用document.body.innerText代替document.write
function reload(){ alert('ce');}window.onload=function(){ alert('a'); setInterval('reload()',1000); document.body.innerText = 'aaa';};
标签:
JavaScript
上一条:javascript - 为什么 body 高度比 canvas 高度多出4个像素?下一条:javascript - 求助在 requireJS 中,$(window).load() 里面的代码 为什么不会执行?
相关文章:
1. docker绑定了nginx端口 外部访问不到2. java - 为什么此私有静态变量能被访问呢?3. angular.js - angular内容过长展开收起效果4. docker容器呢SSH为什么连不通呢?5. nignx - docker内nginx 80端口被占用6. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?7. docker网络端口映射,没有方便点的操作方法么?8. php - mysql 模糊搜索问题9. dockerfile - 我用docker build的时候出现下边问题 麻烦帮我看一下10. php - 第三方支付平台在很短时间内多次异步通知,订单多次确认收款
排行榜
