/    Sign up×
Community /Pin to ProfileBookmark

hmm…Move Object

This used to work, then I tried to change it to move without button after a certain amount of time to no avail, and now I can’t get it to move with the button. Any suggestion? I have attached the gif as well.

<html>
<head>
<title>Animation</title>
<script language=”JavaScript” type=”text/javascript”>

var position, up, upper, uppermost, upperupmost;
funciont init() {

var position = 1;
var up = new image();
up.src = “balloon.gif”;

var upper = new image();
upper.src = “balloon1.gif”;

var uppermost = new image();
uppermost.src = “balloon2.gif”;

var upperupmost = new image();
upperupmost.src = “balloon3.gif”;
ball = document.getElementById(“balloon”);
}
funcion move() {
if(position == 1) {
document.balloonimg.src=up.src;
ball.balloon.style.left = 50;
ball.balloon.style.top = 200;
position = 2;
}
else if (posistion == 2) {
document.balloonimg.src=upper.src;
ball.balloon.style.left = 100;
ball.balloon.style.top = 150;
position = 3;
}
}
else if (posistion == 3) {
document.balloonimg.src=uppermost.src;
ball.balloon.style.left = 150;
ball.balloon.style.top = 100;
position = 4;
}
else if (posistion == 4) {
document.balloonimg.src=upperupmost.src;
ball.balloon.style.left = 200;
ball.balloon.style.top = 10;
position = 1;
}
}
</script>
</head>
<span id =”balloon” style =”position:absolute; left:10; top:250″>
<img name =”balloon” src=”balloon.gif”>
</span>
<form>
<input type =”button” name =”move” value =”Move”
onclick=”startMove=setInterval(‘move()’,900);”>
<input type =”button” name =”stop” value =”Stop”
onclick=”clearInterval(starMove);”>
</form>
</body>
</html>

[upl-file uuid=f4b1f9fd-0a2c-470e-b1cf-1562e2f4a015 size=10kB]balloon.gif[/upl-file]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @Shirls spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...