b-phase: Div Slider

Beitrag lesen

ok, jetzt blamier ich mich gleich völlig, im neuen Script war ein Fehler, es funktioniert doch nicht, hier noch mal alle beide Funktionen, slideDown funktioniert, moveDown nicht. moveDown verliert wie gesagt nach dem ersten Timerdurchlauf das obj.

function init(){
        if(document.getElementById){
        obj = document.getElementById("gallery");
        obj.style.top = "0";
        }
}
function slideDown(){
        if(document.getElementById){
                if(parseInt(obj.style.top) < 200){
        obj.style.top = parseInt(obj.style.top) + 2 + "px";
                        setTimeout("slideDown()",10);
                }
        }
}
function moveDown(target, pos){
obj = document.getElementById(target);
        obj.style.top = pos;
        if(document.getElementById){
                if(parseInt(obj.style.top) < 200){
        obj.style.top = parseInt(obj.style.top) + 2 + "px";
                        setTimeout("moveDown()",10);
                }
        }
}

<body onload="init()">
<a href="javascript:moveDown('gallery', '0')">Galerie</a><br />
<a href="javascript:slideDown()">Galerie</a></div>