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
| <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>[...]</title>
<style type="text/css">
#div_move {
position : absolute;
top : 200px;
width : 100px;
height : 100px;
border : 1px solid black;
}
</style>
</head>
<body>
<div id="div_move"></div>
<script type="text/javascript">
var oDiv = document.getElementById('div_move');
function deplace(){
if( oDiv.offsetTop > 0){
oDiv.style.top = (oDiv.offsetTop -5) +"px"
setTimeout( arguments.callee, 10);
}
}
deplace();
</script>
</body>
</html> |
Partager