Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > I Need JavaScript Help

I Need JavaScript Help
Thread Tools
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Jan 10, 2003, 09:25 PM
 
When I say help, I basically mean I wan't someone to write a script for me. Now I'm not lazy, I have over 1300 pages of JavaScript reference in front of me, and I worked on this for over a day, and it simply WOULD NOT WORK. I would copy things directly from the books and... nothing. This happens every time I try to write a JavaScript, thats why I hate it so much. Well anyway, heres what I need, broken down into section.

The Script I need is a banner swapper, like swap one every 2 seconds or so.

So first thing I did was create an array with the numbers 1 thru 8. Then I made a section that would take two random numbers within this array, and swap them. It would do this 16 times, so as to sufficiently shuffle the deck. Then I made a pretty standard loop that would increment which member of the array was used. I went in order, which was already shuffled. I like this technique because it would show you all the images in a row, never the same one twice etc, but the order would be different every time you visited the site. I also didn't preload the images, because for something like this, it really didn't matter about the time to load, like it would with a rollover. Plus I wanted to keep the script small and simple. To make it repeat every 2 seconds, I used some odd keyword like SetTimeOut(2000) or something like that. I called the main function onload and named the image object so I could change its contents. I did everything right, and literally by the book. But still not even close to working. So basically I'm wondering if someone thats actually GOOD with javascript can write me up a script like this that works.

More info: I used the array and then called the images like this"

image.src = "/images/" + num[i] + ".gif"

I called the image source the right way though
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:02 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2