CSS
-Tricks
treehouse :
what would you like to learn today?
Web Design
Web Development
iOS Development
Show search box
Search
Search in:
All
Articles
Forums
Snippets
Videos
✕
Home
Forums
Snippets
Gallery
Videos
Almanac
Demos
Lodge
Navigation 'n' Search
Forums
Illustration by Nick Sirotich
Forums
»
Other Discussions
[Solved] Looking for a script.
fectio1
Permalink to comment
#
March 2012
I need to rotate through an affiliate ad and another ad when the page is refreshed. I don't really want to use a plugin. Can someone point me in the right direction.
karlpcrowley
Permalink to comment
#
March 2012
One way I've done before was make them have a 50/50 chance of showing
if (rand() % 2 == 0 ){
//show one ad
} else {
//show another
}
This generates a random number, and checks if its odd or even
Not perfect, but worked for me
fectio1
Permalink to comment
#
March 2012
Thanks
Add a Comment
Not perfect, but worked for me