<div> verschieben

Acriss

Gesperrt
Guten Abend,
ich moechte gerne einen div verschieben, und zwar so, das eine Art Animation ensteht.
Mein bisheriger Anlauf funktiniert nicht:
PHP:
function links()
{
document.getElementById('Fass').style.top += '10px';
setTimeout("links()",10);
}
links;

<div id="Fass" style="position:absolute;top:10px;left:400px;display:none">F<br />A<br />S<br />S</div>

danke für Hilfe :)
 
Hi.

  • Das Objekt wird an eine vordefinierte Position (top:500px) verschoben:
Code:
function links(){
         obj = document.getElementById("Fass");
         if(obj){
                if(parseInt(obj.style.top) < 500){
                        obj.style.top = parseInt(obj.style.top) + 10 + "px";
                        setTimeout("links()",10);
                }
         }
}

window.onload = function(){
links();
}
  • Das Objekt läuft und läuft und läuft und läuft ... :)
Code:
function links(){
         obj = document.getElementById("Fass");
         if(obj){
                //if(parseInt(obj.style.top) < 500){
                        obj.style.top = parseInt(obj.style.top) + 10 + "px";
                        setTimeout("links()",10);
                //}
         }
}

window.onload = function(){
links();
}
 
Vielen lieben Dank :)
Super von dir, es klappt :)

Kannst du mir noch verraten wofür ParseInt steht?
Danach waere das Thema dann erledigt ;)
 
Zurück