Solo per dare un' idea dello Straystudio pensiero :
commenta con // la riga dell' alert
//alert(document.getElementById("area").style.margin Left+" \nL = "+L);
Puoi recuoerare L come Integer o tenere il valore in pixel.codice:<html> <head> <script language="JavaScript"> <!-- var L = 0; function moveRight(){ L++; document.getElementById("area").style.marginLeft = L +"px"; alert(document.getElementById("area").style.marginLeft+" \nL = "+L); } // --> </script> </head> <body> <input value="=>" type="button" onClick='moveRight();'> <div style="height: 100%; border: 1px solid black; background-image: url(http://www.dija.it/public/tyler.jpg); background-repeat: no-repeat;"> <div id="area" style="width: 270; height: 294; border: 2px dashed red;"></div> </div> </body> </html>

Rispondi quotando