Codice PHP:
<html>
<
head>
<
style type="text/css">
#box{
    
width100px;
    
height100px;
    
positionabsolute;
    
background#ccc;
    
left200px
}
</
style>
<
script type="text/javascript">
    
window.onload init;
    function 
start(direct){
        
        var 
mov 5;
        var 
obj document.getElementById('box');
        var 
curPos obj.style.left;
                      
alert(curPos)
        var 
fine curPos.indexOf('px');
        var 
curPos =  Number(curPos.substring(0,fine));
        
obj.style.left parseInt(mov+curPos)+'px';
    }
    function 
init(){
        
setInterval(function(){start('l');},500);
    }    
</script>
</head>
<body>
    <div id="box">il mio box !</div>
</body>
</html> 
- il problema è che curPos parte da 0 anche se nel css è impostato a 200px, come si può fare?

- se dovessi fare spostare il div a sinistra ho provato cosi ma non funzia
Codice PHP:
obj.style.left '-'+parseInt(mov+curPos)+'px'
grazie