s_gibson86 Posted April 20, 2007 Share Posted April 20, 2007 Hey, As the title describes, i am having a bit of trouble creating a script which will move an image back and forth across the screen. I have been to my lecturer for a bit of advice and hoping that he would point me in the right direction but no such luck. So far i have written the script to make it move from left to right across the screen but now i'm struggling to make it move right to left and so forth. I am new to Javascript so a nudge in the right direction would be a huge help. This is my script so far:Thank youSarah var max_x = 1024var cup = document.getElementById("cup")var cup_x = 0function moveWin(){ cup_x = cup_x + 10 cup.style.left = cup_x + 'px' if (cup_x <= max_x) { timerID = setTimeout("moveWin()", 25) }}function clicked(thing){ moveWin()} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now