Проблемы с IE
Есть такой код.
function afun(divname,play){
document.getElementById('stop').onclick=function(){clearInterval(s);}
var position='';
var l=0;
var i=0;
var e=document.getElementById(divname);
var num=document.getElementById(divname).children.length;
while(i<num){
position+=parseInt(Math.floor(Math.round()*screen.width)+screen.width/2+200 , 10);
position+='^';
i++;
}i=0;
positionarry=position.split('^');
while(i<num){
document.getElementById(divname).children[i].style.left=positionarry[i]+'px';i++; //document Недопустимое значение о.О
}
function animate(){
l--;
while(i<num){
e.children[i].style.left=l+'px';i++;
}
i=0;
}
var s=setInterval(function(){animate();},100);
}
afun('firstdiv',true);
Интернет Эксплорер отказывается выполнять код и считает что document недопустимое значение. Через ранее выражено вырождение e var e=document.getElementById(divname); вытался выразить но пишет тоже самое. В других браузерах работает,но ещё не так как хотелось бы . . . Но это исправим. Главная проблема. Почему ИЕ видит ошибку там где её нет? |
koeshiro,
а где минимальный html ? |
рони,
Полная страница.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=window-1251" />
<title>Я Мерепещающаяся картинка!</title>
<style>
body{padding:0;margin:0;}
#slidediv1{width:100%;height:100%;position: fixed;}
.tdiv{position: fixed; width:300px; height:30px; background: black; top:0; left:20px; color:#f99206;padding:5px;}
.bdiv{position: fixed; width:300px; height:30px; background: black; bottom:0; right:20px; color:#f1f1f1;padding:5px;}
.newsdiv{position: fixed; width:300px; height:300px; background: black; bottom:100px; right:20px; color:#f1f1f1;padding:5px; border-radius:10px 10px 10px 10px dashed black;}
.newsdiv2{position: fixed; width:300px; height:300px; background: black; bottom:500px; right:70px; color:#f1f1f1;padding:5px; border-radius:10px 10px 10px 10px dashed black;}
</style>
</head>
<body >
<div id="slidediv1" style="background:url(file:///C:/Users/Rail-gun/Desktop/e9zca.jpg);"></div>
<div class="tdiv"><div align="center"><b>Картинка:</b> Небеса</div></div>
<div class="bdiv"><div id="stop">Стоп.</div></div>
<div id="firstdiv">
<div class="newsdiv"></div>
<div class="newsdiv2"></div></div>
<script>
function afun(divname,play){
document.getElementById('stop').onclick=function(){clearInterval(s);}
var position='';
var l=0;
var i=0;
var e=document.getElementById(divname);
var num=document.getElementById(divname).children.length;
while(i<num){
position+=parseInt(Math.floor(Math.round()*screen.width)+screen.width/2+200 , 10);
position+='^';
i++;
}i=0;
positionarry=position.split('^');
while(i<num){
document.getElementById(divname).children[i].style.left=positionarry[i]+'px';i++;
}
function animate(){
l--;
while(i<num){
e.children[i].style.left=l+'px';i++;
}
i=0;
}
var s=setInterval(function(){animate();},100);
}
afun('firstdiv',true);
</script>
</body>
</html>
|
koeshiro,
строка 31 какая-то ересь Цитата:
|
рони,
от этого нечего не меняется. Лишнее там только забытый parseInt А так это всего лишь рандобное положение элементов на экране. |
koeshiro,
Цитата:
alert(Math.round()); |
Ёкарный бабай. Спасибо. Даже ведь в прошлом посту не заметил что не то написал.
|
| Часовой пояс GMT +3, время: 21:55. |