Спс....Нероботает((
Как зделать чтоби оно так двигалось но щелчком на белий блок он двигаетса влево повторнии назад на свое место?
<html>
<head>
<title>Image Mover</title>
<style>
DIV.movable {
position:absolute;
position: relative;
height: 100px;
width:300px;
background-repeat: no-repeat;
float:right;
background-color: #CCC;
}
.blockBlue {
width:1000px;
height:100px;
background-color: #06F;
}
</style>
<script language="javascript">
var x = 0; //Starting Location - left
var y = 0; //Starting Location - top
var dest_x = 300; //Ending Location - left
var dest_y = 300; //Ending Location - top
var interval = 10; //Move 10px every initialization
function moveImage() {
//Keep on moving the image till the target is achieved
if(x<dest_x) x = x + interval;
//Move the image to the new location
document.getElementById("ufo").style.top = y+'px';
document.getElementById("ufo").style.left = -x+'px';
if ((x+interval < dest_x) && (y+interval < dest_y)) {
//Keep on calling this function every 100 microsecond
// till the target location is reached
window.setTimeout('moveImage()',100);
}
}
</script>
</head>
<body onLoad="moveImage()">
<div class="blockBlue"><div id="ufo" class="movable">
</div></div>
</body>
</html>