[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Форум » ***Всё для Ucoz*** » Всё для Ucoz » Бабочка. Перемещающийся по экрану (Бабочка. Перемещающийся баннер или тп.)
Бабочка. Перемещающийся по экрану
GrozaZoolДата: Вторник, 03.05.2011, 23:32 | Сообщение # 1

Главный админ

Сообщений: 141
Репутация: 12784
Статус: Offline

Code

<html>
<head>
<title>Бабочка.</title>
<style>
#normal {POSITION: absolute; VISIBILITY: visible; left: 10px; top: 10px; Z-INDEX: 10000;}
#moving {POSITION: absolute; VISIBILITY: visible; left: 260px; top: 180px; width: 50px; Z-INDEX: 10030;}
</style>
</head>
<body>
<script LANGUAGE="JavaScript1.2">
<!--
var layerRef="null",layerStyleRef="null",styleSwitch="null";
// globale variablen fuers animieren
var dx =  1;
var dy =  1;
var maxgeschw = 99;
if (window.innerWidth) {
      var x  = (window.innerWidth / 2) - 23;
      var y  = (window.innerHeight / 2) - 15;
      var maxx = window.innerWidth - 46;
      var maxy= window.innerHeight - 30;
}
else {
      var x  = (640 / 2) - 23;
      var y  = (400 / 2) - 15;
      var maxx = 640 - 46;
      var maxy= 400 - 30;
}
function init(){
      if (navigator.appName == "Netscape") {
          layerStyleRef="layer.";
          layerRef="document.layers";
          styleSwitch="";
      } else {
          layerStyleRef="layer.style.";
          layerRef="document.all";
          styleSwitch=".style";
      }

}
function moveLayerTo(layerName,left,top){
      eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top=top');
      eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left=left');
}
function animieren(){
      moveLayerTo('moving',x,y);
      if (Math.random() < .2) {
          if (Math.random() < .5) {
              if (Math.random() < .5) {
                  dx= Math.max(-maxgeschw,dx - 1);
              } else {
                  dx= Math.min( maxgeschw,dx + 1);
              }
          } else {
              if (Math.random() < .5) {
                  dy= Math.max(-maxgeschw,dy-1);
              } else {
                  dy= Math.min( maxgeschw,dy+1);
              }
          }
      }
      x += dx;
      y += dy;
      x = Math.max(Math.min(maxx,x),0);
      y = Math.max(Math.min(maxy,y),0);
      if (x==0) {dx = 1}
      if (y==0) {dy = 1}
      if (x==maxx) {dx=-1}
      if (y==maxy) {dy=-1}
      setTimeout('animieren()',70);
}
// -->
</script>
<script LANGUAGE="JavaScript1.2">
<!--
if (navigator.userAgent.indexOf("MSIE 4.0; Mac") == -1 ) {
      init();
      document.writeln('<div id="moving">');
      document.writeln('<a href="http://isofter.ucoz.com"><img src="http://scriptic.narod.ru/gif/reversedo.gif" width=111 height=57 border=0 alt="Link"></a>');
      document.writeln('</div>');
      animieren();
}
// -->
</script>
</body>
</html>


 
Форум » ***Всё для Ucoz*** » Всё для Ucoz » Бабочка. Перемещающийся по экрану (Бабочка. Перемещающийся баннер или тп.)
  • Страница 1 из 1
  • 1
Поиск:



Яндекс.Метрика
Copyright © 2010-2024г