mikemay
10-30-2004, 08:55 PM
Can any one help me on this i am tryin to move a image in random directions up and down i don't know if this is close or not but here what i have so far
Thanks
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>move</title>
<script language="JavaScript" type="text/javascript"><!--
function moveObject(objectID) {{m=0;
e=document.getElementById("z");
if(h>700){h=h-50;m=1;}
if(h<50){h=h+50;m=1;}
if(v>350){v=v-50;m=1;}
if(v<50){v=v+50;m=1;}
if(!m){n=Math.random()*100-50;o=Math.random()*100-50;h=h+n;v=v+o;}
e.style.left = h + 'px';
e.style.top = v + 'px';
}
// -->
</script>
</style>
<style type="text/css" media="screen">
#image{
position: absolute;
top: 13px;
left: 7px;
width:800px;
height: 544px;
}
</style>
</head>
<body>
<img src="xlionpair.jpg" width="800" height="544" id="image" onclick="myfunction"/>
</body>
</html>
Thanks
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>move</title>
<script language="JavaScript" type="text/javascript"><!--
function moveObject(objectID) {{m=0;
e=document.getElementById("z");
if(h>700){h=h-50;m=1;}
if(h<50){h=h+50;m=1;}
if(v>350){v=v-50;m=1;}
if(v<50){v=v+50;m=1;}
if(!m){n=Math.random()*100-50;o=Math.random()*100-50;h=h+n;v=v+o;}
e.style.left = h + 'px';
e.style.top = v + 'px';
}
// -->
</script>
</style>
<style type="text/css" media="screen">
#image{
position: absolute;
top: 13px;
left: 7px;
width:800px;
height: 544px;
}
</style>
</head>
<body>
<img src="xlionpair.jpg" width="800" height="544" id="image" onclick="myfunction"/>
</body>
</html>