Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > HTML / DHTML

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 10-17-2013, 05:02 AM   #1
fredpeterson543
Registered User
 
Join Date: Jul 2013
Posts: 173
DHTML animation question?

I wonder if anyone could help me with this simple DHTML movement question. I am trying to get my ball to go right then left in a smooth manner. I can get it to go right fine, but it jerks back to the left. I have tried all sorts of variables but it doesn't seem to want to work. The code is this:

<html>
<head>

<script language = "javascript">
dir = 0

function move() {
if(dir == 0) {
ball.style.pixelLeft +=3

if(ball.style.pixelLeft>=400)
ball.style.pixelLeft =-3
}

else if(ball.style.pixelLeft<20) {
ball.style.pixelLeft +=3}


setTimeout("move()", 30)
}
</script>

</head>


<body onload="move()">
<img src = "ball.jpg" style="position: absolute; left: 30px; width: 100px; height: 100px" id="ball">

</body>
</html>

give me your advice please
Web Designing Companies in Delhi | Wedding Planners in Delhi | Event Management Companies in Delhi

Last edited by fredpeterson543; 02-07-2016 at 01:19 AM..
fredpeterson543 is offline   Reply With Quote

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to drive traffic using forum / asking question website? dewanshahedur Traffic Corner 8 10-13-2013 01:22 AM
Askoverflow.com :A Question Answering Website to Get Free Backlinks IamRobin Post your ad here 0 03-26-2013 10:18 AM
Question about using php with dhtml tables wryfhk22 PHP / mySQL 0 09-17-2011 01:59 AM


All times are GMT -7. The time now is 06:51 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.