|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Jul 2003
Location: USA
Posts: 604
|
Yes, another random rotating banner ad question.
Okay,
this is more of a feasibility study right now. I have a list of 3 companies in a MySql db. Each company has its own banner ad. I would like to have the three banners randomly rotate at an incriment of 5 seconds. the thing that really screws this up is that I need each banner to be clickable to its respective link (generated from the db along with the banner). is this even possible with JS? I know that i can make 5 second rotating images. and i know i can make a random image/url on page load. but is it possible to merge the two? I am thinking that with JS it probably is not possible since the url would have to change with each graphic rotation. secondly i don't think i can easily connect to a db using JS. I have considered Flash ActionScript, but have never really used it, and would hate to blow alot of time to learn a new language just for on little banner rotator. any ideas? |
|
|
|
|
|
#2 |
|
Tool
![]() ![]() ![]() ![]() Join Date: Sep 2005
Location: Cambridge, UK
Posts: 3,804
|
It's certainly possible. You just change the href attribute (linkvar.setAttribute('href','hrefarray[i]')) of the banner link with every rotation along with the img src (imgvar.setAttribute('src','srcarray[i]')). You then just randomise i every 5 seconds.
You would probably need to put the three links in an array and the three image srcs in another array (keeping the indexes parallel) and then randomising the indexes with each rotation. Though I don't see much point in it being random if you only have three. |
|
|
|
|
|
#3 |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Jul 2003
Location: USA
Posts: 604
|
good info raff....
I'll give 'er the ol college try. Ultimately there will be more than three, but for now in the testing phase i keep it relitively small. Thanks R |
|
|
|
|
|
#4 |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Jul 2003
Location: USA
Posts: 604
|
So i got this thing to work, however, it works in IE and not in Firefox.
does firefox have issues processing onLoad commands (specifically setTimeout) within img tags? The banner displays in Firefox, but does not rotate. works fine in IE. R |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 16:44.












Hybrid Mode
