Thorp and Sailor's Grave Board
Not logged in [Login - Register]
Go To Bottom

Printable Version  
Author: Subject: Arrays?! WTF DOES IT MEAN?
Siczine.com
Posting Freak
*****


Avatar


Posts: 2351
Registered: 9-6-2005
Location: Philly
Member Is Offline

Mood: Cynical

[*] posted on 1-31-2008 at 07:08 PM
Arrays?! WTF DOES IT MEAN?


Web Banner Code

I am trying to get more rotating banners and this code should do that, however, I am not quite sure what "//store the quotations in arrays" means. Any help is greatly, greatly appreciated.




View user's profile Visit user's homepage View All Posts By User
Siczine.com
Posting Freak
*****


Avatar


Posts: 2351
Registered: 9-6-2005
Location: Philly
Member Is Offline

Mood: Cynical

[*] posted on 1-31-2008 at 07:08 PM


The above example is images of some of our different advertisers. If you refresh or reload the page in your browser, you should get a different image (if you get the same, try again.) We wrote this basic script to allow viewers of your web page to get a new look each time they come to your web page.

Source code






View user's profile Visit user's homepage View All Posts By User
BDx13
Super Administrator
*********


Avatar


Posts: 18115
Registered: 8-25-2004
Location: Pennsyltucky
Member Is Offline


[*] posted on 1-31-2008 at 07:35 PM


right now, you have four arrays, numbered 0, 1, 2, and 3.

if you want a wider variety of banners to display, you need to define the number you want, then define the details of each. so...

- change the number in "images = new Array(4);" to the number of banners you want to display. You want 12 different ads, make it "images = new Array(12);" (without the quotation marks).

- then repeat "images[3] = "Computer Hope Newsletter";" (again, without the double quotes) a total of 12 times. be sure to change the number at the beginning, the URL to which you want to direct your users when they click (that's the a href part) and the location of your banner ad (that's the img src part).





If I fail math, there goes my chance at a good job and a happy life full of hard work.
View user's profile Visit user's homepage View All Posts By User
BDx13
Super Administrator
*********


Avatar


Posts: 18115
Registered: 8-25-2004
Location: Pennsyltucky
Member Is Offline


[*] posted on 1-31-2008 at 07:45 PM


lemme know if that's unclear, and i can try again.




If I fail math, there goes my chance at a good job and a happy life full of hard work.
View user's profile Visit user's homepage View All Posts By User
Siczine.com
Posting Freak
*****


Avatar


Posts: 2351
Registered: 9-6-2005
Location: Philly
Member Is Offline

Mood: Cynical

[*] posted on 2-1-2008 at 05:51 PM


Okay, so say I want four, is this what the part of code I would put in?

images = new Array(4)

images[0] = "Visit Computer
Hope";

images[1] = "Computer
History";

images[2] = "Visit Computer
Hope";

images[3] = "Computer Hope
Newsletter";

index = Math.floor(Math.random() * images.length);

document.write(images[index]);

//done

// -->




View user's profile Visit user's homepage View All Posts By User
Siczine.com
Posting Freak
*****


Avatar


Posts: 2351
Registered: 9-6-2005
Location: Philly
Member Is Offline

Mood: Cynical

[*] posted on 2-1-2008 at 05:51 PM


Thanks for the help too by the way BD.



View user's profile Visit user's homepage View All Posts By User
Siczine.com
Posting Freak
*****


Avatar


Posts: 2351
Registered: 9-6-2005
Location: Philly
Member Is Offline

Mood: Cynical

[*] posted on 2-1-2008 at 05:56 PM


I'm a retard. But I finally got it. Thanks BD!



View user's profile Visit user's homepage View All Posts By User
BDx13
Super Administrator
*********


Avatar


Posts: 18115
Registered: 8-25-2004
Location: Pennsyltucky
Member Is Offline


[*] posted on 2-1-2008 at 06:11 PM


yeah, you were just missing the top part that identifies the code a javascript.

so you got it working? if you need any other help, send me a u2u and i'll hook it up for ya.





If I fail math, there goes my chance at a good job and a happy life full of hard work.
View user's profile Visit user's homepage View All Posts By User
Siczine.com
Posting Freak
*****


Avatar


Posts: 2351
Registered: 9-6-2005
Location: Philly
Member Is Offline

Mood: Cynical

[*] posted on 2-1-2008 at 06:19 PM


Yo BD, one last question. Everything is fine but is there anyway I can get rid of the blue boarders?



View user's profile Visit user's homepage View All Posts By User
BDx13
Super Administrator
*********


Avatar


Posts: 18115
Registered: 8-25-2004
Location: Pennsyltucky
Member Is Offline


[*] posted on 2-1-2008 at 06:36 PM


there is a border property for images that sets the size of the border around an image. by default, it's one pixel, but you can remove it by setting it to zero:

img src='http://www.computerhope.com/banners/banner4.gif' alt='Computer Hope Newsletter' border='0'

just don't forget the beginning and end carrots (the < and > ) . If i include them in my post, it's not simply displaying the code, but actually rendering it.





If I fail math, there goes my chance at a good job and a happy life full of hard work.
View user's profile Visit user's homepage View All Posts By User
Siczine.com
Posting Freak
*****


Avatar


Posts: 2351
Registered: 9-6-2005
Location: Philly
Member Is Offline

Mood: Cynical

[*] posted on 2-1-2008 at 07:14 PM


Yeah for some reason I figured because it had "//Javascript Created by Computerhope http://www.computerhope.com
//store the quotations in arrays" that all that should be excluded, completely forgetting most codes that end with a > need to begin with a <.

And thanks for the tip about the boarders, got that to work as well!




View user's profile Visit user's homepage View All Posts By User
BDx13
Super Administrator
*********


Avatar


Posts: 18115
Registered: 8-25-2004
Location: Pennsyltucky
Member Is Offline


[*] posted on 2-2-2008 at 04:19 PM


great, glad to hear it.




If I fail math, there goes my chance at a good job and a happy life full of hard work.
View user's profile Visit user's homepage View All Posts By User

  Go To Top

Powered by XMB 1.9.11
XMB Forum Software © 2001-2011 The XMB Group