How to create a banner that loads different images with each page refresh.

I found this code somewhere, sorry I don't remember where, but it works great for a rotating banner.  

 


Attached is code from MY site, please replace the the GirlRiders addresses, images and alt text with your own.  Then paste in a text box on your ning site.

 

You need to setup your images the exact size you want and store them somewhere so you can add the href address to the code.

Copy the line of code down and change the info for however many images you want in rotation.

 

 

See it in action here:  http://GirlRiders.ning.com  Its the top center text box. Hit refresh to see it change.  I plan to add more images when I have time to make them.

 

ENJOY :)

 

 

<SCRIPT LANGUAGE="Javascript">
function banner() { } ; b = new banner() ; n = 0
b[n++]= "<A HREF='http://girlriders.ning.com/page/the-one-stop-shop-support'><IMG name=randimg SRC='http://girlriders.net/banner/shop-sm.png' border='0' ALT='GirlRiders One Stop Shop'></A>"
b[n++]= "<A HREF='http://girlriders.ning.com/events'><IMG name=randimg SRC='http://girlriders.net/banner/events-sm.png' border='0' ALT='GirlRiders Join an Event or Plan your Own'></A>"
b[n++]= "<A HREF='http://girlriders.ning.com/forum'><IMG name=randimg SRC='http://girlriders.net/banner/discussion-sm.png' border='0' ALT='GirlRiders Discuss anything in the Forums'></A>"
i=Math.floor(Math.random() * n) ;
document.write( b[i] )
</SCRIPT>

 

Tags: banner, image, load, refresh

Views: 496

Attachments:

Reply to This

Replies to This Discussion

Hey, thanks for sharing. I'd be interested to hear if anyone else implements this or something similar.
yes, check the other thread
Check this out. Minds-Eye
There are other options where you go to a website and give them your info and they create the code for you. But this one gives you more control and doesn't hide anything in there that you wouldn't want.
Thanks,
Look very good, but I can't get the code.
How can I get the code?
Save the attachment to your computer than use a text or html editor to open and modify.
All l get is the image and no codes.
See my response above your comment.
I just added the code to the post, but you probably want to save the file and edit, not copy paste.
I would be interested in finding the code for the horizontal viewer that many of the nings are using on their front page highlighting areas of the ning, and can even have a link to a page or group.

The one I am looking for is similar to the one ning is using on the front page here. Or it can be used to post banners that will move left to right and then back, these do not loop.

Anyone have an idea on how this is done and the code used? Thanks
Hi Jaap, unfortunatley that is not my site, it is one Im using as an example, for what I am looking for the way they put the banner that scrolls. Mine is http://livelaughandlovetoshop.ning.com and I'm in the process of making changes to front page for more appealing look.
I would love to put that on my site... is that scripts4ning?

RSS

Latest Activity

Strumelia replied to FedMedic's discussion '3.0 Why is all my text centered?'
"Thanks so much, and please DO let me know what their support team is like, when you first make use…"
45 minutes ago
SM replied to SM's discussion 'How to Target the First Page of your Site with CSS'
"Hi Suzie, I'll try to post something more logical with screen shots. But, you'll see -…"
53 minutes ago
SM replied to SM's discussion 'How to Target the First Page of your Site with CSS'
"Hi Kos, the reason for the code is to have elements only display on the home page. By default, Ning…"
58 minutes ago
soaringeagle replied to Phil McCluskey's discussion 'Introducing the Spam Folder'
"it seems a few of us have the same concerns/questions i can see a reason for secrecy as in you…"
58 minutes ago
soaringeagle replied to Phil McCluskey's discussion 'Introducing the Spam Folder'
"this is wonderful news but can u define "content" does it include comments on…"
1 hour ago
FedMedic replied to FedMedic's discussion '3.0 Why is all my text centered?'
"Hi Strumelia! Thank you! I'm still working with various tools and toys and it's amazing!…"
1 hour ago
Suzie Nielsen replied to SM's discussion 'How to Target the First Page of your Site with CSS'
"SM ,Oh I see now... This sounds awesome! I might try but now the code for it is in snippets in five…"
1 hour ago
Kos replied to SM's discussion 'How to Target the First Page of your Site with CSS'
"SM:  i get the header desire however I'm a bit confused on the "side bar" issue…"
1 hour ago

© 2013   Created by Ning.

Badges  |  Report an Issue  |  Terms of Service