PDA

View Full Version : HELP! Racetrack script...


mplutodh1
05-16-2003, 12:58 AM
I need to get this script to work, I need the race car to drive around in an oval within the document.window. I need 3 buttons, each one making the car go at a different speed. I also need a button to stop the animation. Please help.

<HTML>
<HEAD>
<TITLE>Racetrack</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
var position = 0;
var go;
horizontal = new Array(16);
vertical = new Array(16);
// horizontal position
horizontal[0] = 350;
horizontal[1] = 455;
horizontal[2] = 570;
horizontal[3] = 650;
horizontal[4] = 675;
horizontal[5] = 650;
horizontal[6] = 570;
horizontal[7] = 455;
horizontal[8] = 350;
horizontal[9] = 235;
horizontal[10] = 130;
horizontal[11] = 45;
horizontal[12] = 15;
horizontal[13] = 45;
horizontal[14] = 130;
horizontal[15] = 235;

//vertical position
vertical[0] = 30;
vertical[1] = 45;
vertical[2] = 75;
vertical[3] = 130;
vertical[4] = 200;
vertical[5] = 265;
vertical[6] =
vertical[7] = 355;
vertical[8] = 365;
vertical[9] = 355;
vertical[10] = 320;
vertical[11] = 265;
vertical[12] = 200;
vertical[13] = 130;
vertical[14] = 75;
vertical[15] = 45;

function drive() {
//THIS IS WHERE I GET MESSED UP AND NEED HELP.....

// .... document.all.racecar.style.left = ???
// .... document.all.racecar.style.top = ???

++position;
if (position == 16)
position = 0;
}
function startDriving(speed) {
clearInterval(go);
go = setInterval("drive()",speed);
}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->


</SCRIPT>
</HEAD>
<BODY>
<hr>
Create the form here!
<!-- Create the form here! -->
<hr>
<SPAN ID="racecar" STYLE="position:absolute; left:350; top:30">
<IMG SRC="racecar.gif" HEIGHT=33 WIDTH=100>
</SPAN>
</BODY>
</HTML>

mplutodh1
05-16-2003, 02:19 AM
anyone? please...

mplutodh1
05-16-2003, 03:38 AM
wow this is for class and is due in 20 mins... no one can honestly help me...?

Roy Sinclair
05-16-2003, 03:59 PM
Originally posted by mplutodh1
wow this is for class and is due in 20 mins... no one can honestly help me...?

You've got it in one. Honestly, if you wait until the last minute before your deadline and want help this is exactly the kind of response you can expect.

We are willing to help here but we don't do "instant" answers unless you happen to be lucky enough that someone willing to answer happens onto your message right after you post and they don't need to work a long time on the answer. Your problem was simply too incomplete to even begin to give you an answer before your deadline and as a habit we don't "give" answers to classroom assignments, instead we give hints on how it's done. If you don't do your own work, you'll never learn.

mplutodh1
05-16-2003, 05:02 PM
Well first off I never once said it was assigned a month ago. It was assigned yesterday morning so watch it.

As for incomplete... I gave you everything I was given, so maybe your problem isnt necessary with my post but rather my professor. I am confused and figured maybe someone could atleast guide me. If it wasnt complete you could have asked me questions and IF i knew the answer I could have answered.

Roy Sinclair
05-16-2003, 05:24 PM
Watch what? You're the one wanting help, don't get sassy or you'll find it even harder to get help in the future.

Perhaps if you understood that "vertical" positions correspond to the "top" style you'd understand what you need to finish your script.

mplutodh1
05-16-2003, 07:05 PM
I just joined this forum, my post asking if anyone could help was more just a plea for help... never once did i EXPECT help from anyone.

so you jump all over me for asking and saying i needed it soon... only to maybe see if someone was thinking of helping they might do it then...

im not someone who takes lightly to being jumped on like you did, and then your replying yet again in an attempt to make me look like a dumba$$... whatever, honestly what did you accomplish? did it make your day better?

Philip M
05-16-2003, 07:16 PM
Children should be seen and not heard.

Roy Sinclair
05-16-2003, 07:25 PM
I just joined this forum, my post asking if anyone could help was more just a plea for help... never once did i EXPECT help from anyone.

Your original post and the two additional posts you added after that contradict your claims above.

im not someone who takes lightly to being jumped on like you did, and then your replying yet again in an attempt to make me look like a dumba$$... whatever, honestly what did you accomplish? did it make your day better?

I hoped to help you understand the concept of how to get help in this forum and the kind of help it's proper to ask for. Did the hint I gave help you with your script or are you too overcome with the idea that you're being attacked to bother with it anymore?

mplutodh1
05-16-2003, 07:28 PM
Yes it did help and I thank you. I appologize if I was rude when I asked for help, but I honestly did not think I was. The assignment is over with, I will figure it out on my own. Thank you anyways.