1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
   |  
<html>
<head>
<title></title>
 <style type="text/css">
#boite
        {
        height : 100px;
        width : 100px;
        background-color : red;
        
        position:absolute;
        left:50px;
        }               
</style>
 
<script type="text/javascript">
var position = 50; // left: 50px; - position initiale
 
function chargement()
        {
        if (position>=500) //position > 500, on arrete
            return;
 
        position = position + 2; // pas de 2
 
        document.getElementById("boite").style.left = position  + "px";
                setTimeout("chargement()","50");
        }
</script>
</head>
 
<body onload="chargement();">
 
 
<div id="boite">
Boite !
</div>
 
</body>
 
</html> |