Results 1 to 4 of 4

Thread: ProHTML Ticker

  1. #1
    Join Date
    Nov 2004
    Posts
    16
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default ProHTML Ticker

    1) Script Title: ProHTML Ticker

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...htmlticker.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
    Last edited by Snookerman; 05-08-2009 at 06:09 PM. Reason: added “Resolved” prefix

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:
    Code:
    totalDivs++
    selectedDiv=Math.floor(Math.random()*totalDivs)
    DD Admin

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    davidjovan (12-10-2008)

  4. #3
    Join Date
    Nov 2004
    Posts
    16
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    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.

  5. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Find this part in your JavaScript code:
    Code:
    function startscroller(){
    while (document.getElementById("dropmsg"+totalDivs)!=null)
    totalDivs++
    expandone()
    if (!enablesubject)
    document.getElementById("dropcontentsubject").style.display="none"
    }
    And add the highlighted part:
    Code:
    function startscroller(){
    while (document.getElementById("dropmsg"+totalDivs)!=null)
    totalDivs++
    selectedDiv=Math.floor(Math.random()*totalDivs)
    expandone()
    if (!enablesubject)
    document.getElementById("dropcontentsubject").style.display="none"
    }

  6. The Following User Says Thank You to Snookerman For This Useful Post:

    davidjovan (12-18-2008)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •