Ciao ragazzi ho fatto questo script per muovo un oggetto avanti e indietro, sarei felice se qualcuno mi dica cosa ne pensa e magari consigli utili grazie
codice:<html> <head> <script type="text/javascript"> function down1(){ z = setInterval("muovi1()", 10); } function muovi1(){ x = parseInt(document.getElementById('questo').style.left); document.getElementById('questo').style.left = (x-3)+"px"; } function up2(){ clearInterval(z); } function down(){ z = setInterval("muovi()", 10); } function muovi(){ x = parseInt(document.getElementById('questo').style.left); document.getElementById('questo').style.left = (x+3)+"px"; } function up(){ clearInterval(z); } </script> </head> <body> <div style="position:absolute; left:0px;" id="questo">Normale</div> <input type="submit" value="-" onmousedown="down1();" onmouseup="up2();" /> <input type="submit" value="+" onmousedown="down();" onmouseup="up();" /> </body> </html>



Rispondi quotando