Veröffentlicht 4. November 200321 j hi leute, ich bekomms ma wieder nicht auf die Reihe ;-)) function switchLayer( oLayer, direction) { if ( oLayer == null ) return; if ( direction) { iTopPos+=5; } else { iTopPos-=5; } if ((iTopPos >= -47) && (iTopPos <= 15 )) { oLayer.style.top = iTopPos; setTimeout('switchLayer('+ oLayer +', '+ direction +')',1); } } wie kann ich bei dem setTimeout ein Objekt übergeben? er gibt mir immer ne fehlermeldung das [object] undefiniert ist, was mir auch klar ist warum! aber ich weiss nicht wie ichs jetzt richtig machen soll. Danke + Gruß kills
6. November 200321 j habs gelöst: var iTopPos = -47; function switchLayer( oLayer, bDirection) { if ( oLayer == null ) return; if ( bDirection) { iTopPos+=5; } else { iTopPos-=5; } if ((iTopPos >= -47) && (iTopPos <= 15 )) { oLayer.style.top = iTopPos; setTimeout('switchLayer( getElement( "'+ oLayer.id + '"), '+ bDirection + ');',1); } } function getElement( e) { var el = null; if ( document.all) { el = document.all[ e]; } if ( el == null) { el = document.getElementById( e); } if ( el != null) { return el; } return null; }
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.