【发布时间】:2014-05-09 11:30:16
【问题描述】:
我可以让这段代码在 Chrome 中运行,但不能在 IE(Internet Explorer)中运行。作为浏览器交叉兼容性,是否可以将一些东西迁移到其他浏览器?
<html>
<head>
</head>
<body>
<style>#move{position:absolute;height:100px;width:100px;background-color:cyan}</style>
<script>
var ok=document.createElement("div");
document.body.appendChild(ok);
ok.setAttribute("id","move");
function jobson(a){
switch(a){
case 0:
setInterval(function(){
if(ok.style.backgroundColor="black")ok.style.backgroundColor="cyan"},1);
break;
};
setInterval(function(){
if(ok.style.backgroundColor="cyan")ok.style.backgroundColor="black";ok.style.left
(a)+"px";},1);
//distancia
};
setInterval(function(){
for(var i=0;i<1000;i++){
jobson(i);
};},1);
</script>
</body>
</html>
【问题讨论】:
-
这是 Internet Explorer,你期待什么... -_-
标签: javascript css internet-explorer google-chrome setinterval