Убегающая кнопка
Уважаемые сотрудники, в связи со сложившейся кризисной ситуацией,
проводится опрос сотрудников по поводу размера заработной платы:
Вы довольны своей зарплатой?
Исходный код этого примера:
<p><button style="background-color:red;height:50px;width:70px;" onmouseDown="alert('Отлично, мы планируем понижение её на 30% !!!');parent.location='https://eaiti.ru'" value="ДА!!!">ДА!!!</button>
<span id="button1" style="position:relative;z-index:10" onmouseOver="moveIt()" onfocus="moveIt();this.blur()">
<button style="background-color:lightgreen;height:50px; width:70px;" onmouseDown="moveIt()" onmouseover="moveIt()" onfocus="moveIt();this.blur()">Нет</button>
</span></p>
<script>
function getObj(objID)
{
if (document.getElementById) {return document.getElementById(objID);}
else if (document.all) {return document.all[objID];}
else if (document.layers) {return document.layers[objID];}
}
var ie4=document.all;
var ns6=document.getElementById&&!document.all;
cobj=getObj("button1");
function moveIt(){
y=Math.floor(Math.random()*301);
x=Math.floor(Math.random()*401);
if (ie4){
cobj.style.top = y;
cobj.style.left = x;
}
else if (ns6){
cobj.style.top = y+"px";
cobj.style.left = x+"px";
}
}
</script>
.
Прокомментировать/Отблагодарить