7Priest7
June 21st, 2007, 02:40 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript">
function smash()
{
document.getElementById("foot").style.visibility = visible
var startX=parseInt(document.getElementById("foot").style.left), endX=parseInt(document.getElementById("bug").style.left), startY=parseInt(document.getElementById("foot").style.top), endY=parseInt(document.getElementById("bug").style.top);
var diffX=(endX-startX), diffY=(endY-startY);
while ((diffX < 0 || diffX > 0) || (diffY < 0 || diffY))
{
var curX=parseInt(document.getElementById("foot").style.left);
var curY=parseInt(document.getElementById("foot").style.top);
if(diffX<0){document.getElementById("foot").style.left = curX+1; diffX++;}
if(diffX>0){document.getElementById("foot").style.left = curX-1; diffX--;}
if(diffY<0){document.getElementById("foot").style.top = curY+1; diffX++;}
if(diffY>0){document.getElementById("foot").style.top = curY-1; diffX--;}
}
}
function fly()
{
var a=0,b=0;
while (a <= 100)
{
while (b <= 100)
{
var l=0,r=0;
while (l<=100){document.getElementById("bug").style.left = document.getElementById("bug").style.left - 1; l++;}
while (r<=100){document.getElementById("bug").style.left = document.getElementById("bug").style.left + 1; r++;}
b++;
}
a++;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>The Exterminators</title>
</head>
<body>
<img src="bug.jpg" id="bug" name="bug" style="position: absolute; left: 500px; float: none;" />
<img src="shoe.jpg" id="foot" name="foot" style="position: absolute; float: none; visibility: hidden;" />
<form>
<input type="button" value="Start the Flying" onClick="setTimeout("fly()", 100);" />
<input type="button" value="Kill the Bug" onClick="smash();" />
</form>
</body>
</html>
It is for a school project... It is supposed to work for browsers using the W3C dom....
Regaurdless... I have spent hours coding uncoding and recoding diffrent variations...
This one might work if I could set a delay...
Any/all help appreciated
Please and Thank You
Alex
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript">
function smash()
{
document.getElementById("foot").style.visibility = visible
var startX=parseInt(document.getElementById("foot").style.left), endX=parseInt(document.getElementById("bug").style.left), startY=parseInt(document.getElementById("foot").style.top), endY=parseInt(document.getElementById("bug").style.top);
var diffX=(endX-startX), diffY=(endY-startY);
while ((diffX < 0 || diffX > 0) || (diffY < 0 || diffY))
{
var curX=parseInt(document.getElementById("foot").style.left);
var curY=parseInt(document.getElementById("foot").style.top);
if(diffX<0){document.getElementById("foot").style.left = curX+1; diffX++;}
if(diffX>0){document.getElementById("foot").style.left = curX-1; diffX--;}
if(diffY<0){document.getElementById("foot").style.top = curY+1; diffX++;}
if(diffY>0){document.getElementById("foot").style.top = curY-1; diffX--;}
}
}
function fly()
{
var a=0,b=0;
while (a <= 100)
{
while (b <= 100)
{
var l=0,r=0;
while (l<=100){document.getElementById("bug").style.left = document.getElementById("bug").style.left - 1; l++;}
while (r<=100){document.getElementById("bug").style.left = document.getElementById("bug").style.left + 1; r++;}
b++;
}
a++;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>The Exterminators</title>
</head>
<body>
<img src="bug.jpg" id="bug" name="bug" style="position: absolute; left: 500px; float: none;" />
<img src="shoe.jpg" id="foot" name="foot" style="position: absolute; float: none; visibility: hidden;" />
<form>
<input type="button" value="Start the Flying" onClick="setTimeout("fly()", 100);" />
<input type="button" value="Kill the Bug" onClick="smash();" />
</form>
</body>
</html>
It is for a school project... It is supposed to work for browsers using the W3C dom....
Regaurdless... I have spent hours coding uncoding and recoding diffrent variations...
This one might work if I could set a delay...
Any/all help appreciated
Please and Thank You
Alex