var pos=0; var need=0; var smesh=636; function moveleft() { if((pos+need)>=0){ $('move').style.marginLeft=pos-smesh+"px"; pos=pos-smesh;} } function move () { //int=setInterval("moveleft()",1); moveleft(); } function move_stop() { clearInterval(int); } function moveright() { if(pos<0){pos=pos+smesh; $('move').style.marginLeft=pos+"px";} } function move2 () { //int=setInterval("moveright()",1); moveright(); } function move_stop2() { clearInterval(int); }