• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need to know how to change this code where the object will move down

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>DOWN</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" type="text/JavaScript">
<!--

var row = 0;

//function move turtle towards the bottom
function moveTurtleDown()
{
//This accesses the graphic on the page and moves its position
document.getElementById("turtle").style.left=585+(row*12);

if (row < 10)
{
//You only need 10 iterations to make it to the bottom of the river
row++;
window.setTimeout("moveTuttleDown();",130);
//Recursive function that gives a slight delay in time to look more fluid
}

}//end of moveTuttleDown Function

//-->
</script>
</head>

<body bgcolor="#FFFFCE" >
<div align="center">
<h1><strong>Using DHTML</strong></h1>
<h2><strong>To Make the Turtle Dive</strong><h2>

<div id="Background" style="position:absolute; left:77px; top:100px; visibility:visible; z-index:1; width: 100px; height: 103px;"><img src="backgroundIntro.gif" width="851" height="258"></div>

<div id="turtle" style="position:absolute; left:300px; top:260px; visibility:visible; z-index:2; width: 100px; height: 103px;"><img border="0" src="turtle.gif" width="45" height="53"></div>
</div>

<form>
<input type="button" id="sbutton" value="submit" onClick="moveTurtleDown();">
</form>

</body>
</html>
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what can your code currently do? How is the turtle moving?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What have you done to debug the issue? Have you used the browser's tools to step through the code? Where is it going wrong?
 
Kathryn McMahon
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The turtle was going left to right.
Now he just sets there.
I want him to dive.
Would really like for him to dive and curve to right.
If I can find the command to make him go down, I believe I can make him turn.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Turtle Dive</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" type="text/JavaScript">
<!--

var row = 0;

//function move turtle towards the bottom
function moveTurtleDown()
{
//This accesses the graphic on the page and moves its position
document.getElementById("turtle").style.left=585+(row*12);

if (row < 10)
{
//You only need 10 iterations to make it to the bottom of the river
row++;
}

window.setTimeout("moveTuttleDown();",130);

//Recursive function that gives a slight delay in time to look more fulid
}

}//end of moveTuttleDown Function

//-->
</script>
</head>

<body bgcolor="#FFFFCE" >
<div align="center">
<h1><strong>Using DHTML</strong></h1>
<h2><strong>To Make the Turtle Dive</strong><h2>

<div id="Background" style="position:absolute; left:77px; top:100px; visibility:visible; z-index:1; width: 100px; height: 103px;"><img src="backgroundIntro.gif" width="851" height="258"></div>

<div id="turtle" style="position:absolute; left:300px; top:260px; visibility:visible; z-index:2; width: 100px; height: 103px;"><img border="0" src="turtle.gif" width="45" height="53"></div>
</div>

<form>
<input type="button" id="sbutton" value="submit" onClick="moveTurtleDown();">
</form>

</body>
</html>
 
machines help you to do more, but experience less. Experience this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic