PDA

View Full Version : Resolved ProHTML Ticker



davidjovan
12-09-2008, 12:24 PM
1) Script Title: ProHTML Ticker

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/prohtmlticker.htm

3) Describe problem:

The script works fine. I was wondering if someone would be able to make the messages be random instead of having to number each message like below:

<div id="dropmsg1"

<div id="dropmsg2"

Random would be better.

I am using the script here to change the different Ads on the page:
www.dancehallcelebrities.com

Thanks for your time

ddadmin
12-10-2008, 08:52 AM
There's no quick way to randomize the content shown each time it rotates (ie: every 2 sec). However, you can easily randomize which content gets shown when the page first loads with the code in red:


totalDivs++
selectedDiv=Math.floor(Math.random()*totalDivs)

davidjovan
12-10-2008, 03:03 PM
Thanks for your quick reply. Any randomizing is OK w/me.

Are you talking about changing these codes:

var selectedDiv=0
var totalDivs=0
???

I am a beginner/intermediate user so if you could input the code as it should be, I will copy & paste it in mine.

Thanks.

Snookerman
12-10-2008, 03:11 PM
Find this part in your JavaScript code:

function startscroller(){
while (document.getElementById("dropmsg"+totalDivs)!=null)
totalDivs++
expandone()
if (!enablesubject)
document.getElementById("dropcontentsubject").style.display="none"
}

And add the highlighted part:

function startscroller(){
while (document.getElementById("dropmsg"+totalDivs)!=null)
totalDivs++
selectedDiv=Math.floor(Math.random()*totalDivs)
expandone()
if (!enablesubject)
document.getElementById("dropcontentsubject").style.display="none"
}