Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Rotating Quote bar help?

  1. #1
    Join Date
    Jun 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Rotating Quote bar help?

    Hi

    I've got this quote bar up on our board that I really like. The only thing about it I don't like is that every time you open a new page it reverts back to the beginning quote, so unless you stay on one page for quite a while you never get to read all the quotes. I'm wondering if there's a way to change it to display random quotes?

    You can view the quote bar in action here to get a better idea of what I mean:

    http://p101.ezboard.com/btheundergroundcoop


    Here's the script I've used:


    <!-- Begin
    //slider's width
    var swidth=350

    //slider's height
    var sheight=72

    //slider's speed
    var sspeed=1

    //messages: change to your own; use as many as you'd like; set up Hyperlinks to URLs as you normally do: <a target=... href="... URL ...">..message..</a>
    var singletext=new Array()
    singletext[0]='<div align="center"><font face=Arial size=3 color="white">Quote 1</div></FONT>'
    singletext[1]='<div align="center"><font face=Arial size=3 color="white">Quote 2</font></div>'
    singletext[2]='<div align="center"><font face=Arial size=3 color="white">Quote 3</font></div>'
    singletext[3]='<div align="center"><font face=Arial size=3 color="white">Quote 4</font></div>'
    singletext[4]='<div align="center"><font face=Arial size=3 color="white">Quote 5</font></div>'
    singletext[5]='<div align="center"><font face=Arial size=3 color="white">Quote 6</font></div>'
    singletext[6]='<div align="center"><font face=Arial size=3 color="white">Quote 7</font></div>'
    singletext[7]='<div align="center"><font face=Arial size=3 color="white">Quote 8</font></div>'
    singletext[8]='<div align="center"><font face=Arial size=3 color="white">Quote 9</font></div>'
    singletext[9]='<div align="center"><font face=Arial size=3 color="white">Quote 10</font></div>'
    singletext[10]='<div align="center"><font face=Arial size=3 color="white">Quote 11</font></div>'
    singletext[11]='<div align="center"><font face=Arial size=3 color="white">Quote 12</font></div>'
    if (singletext.length>1)
    i=1
    else
    i=0
    function start(){
    if (document.all){
    ieslider1.style.top=sheight
    iemarquee(ieslider1)
    }
    else if (document.layers){
    document.ns4slider.document.ns4slider1.top=sheight
    document.ns4slider.document.ns4slider1.visibility='show'
    ns4marquee(document.ns4slider.document.ns4slider1)
    }
    else if (document.getElementById&&!document.all){
    document.getElementById('ns6slider1').style.top=sheight
    ns6marquee(document.getElementById('ns6slider1'))
    }
    }
    function iemarquee(whichdiv){
    iediv=eval(whichdiv)
    if (iediv.style.pixelTop>0&&iediv.style.pixelTop<=sspeed){
    iediv.style.pixelTop=0
    setTimeout("iemarquee(iediv)",100)
    }
    if (iediv.style.pixelTop>=sheight*-1){
    iediv.style.pixelTop-=sspeed
    setTimeout("iemarquee(iediv)",100)
    }
    else{
    iediv.style.pixelTop=sheight
    iediv.innerHTML=singletext[i]
    if (i==singletext.length-1)
    i=0
    else
    i++
    }
    }
    function ns4marquee(whichlayer){
    ns4layer=eval(whichlayer)
    if (ns4layer.top>0&&ns4layer.top<=sspeed){
    ns4layer.top=0
    setTimeout("ns4marquee(ns4layer)",100)
    }
    if (ns4layer.top>=sheight*-1){
    ns4layer.top-=sspeed
    setTimeout("ns4marquee(ns4layer)",100)
    }
    else{
    ns4layer.top=sheight
    ns4layer.document.write(singletext[i])
    ns4layer.document.close()
    if (i==singletext.length-1)
    i=0
    else
    i++
    }
    }
    function ns6marquee(whichdiv){
    ns6div=eval(whichdiv)
    if (parseInt(ns6div.style.top)>0&&parseInt(ns6div.style.top)<=sspeed){
    ns6div.style.top=0
    setTimeout("ns6marquee(ns6div)",100)
    }
    if (parseInt(ns6div.style.top)>=sheight*-1){
    ns6div.style.top=parseInt(ns6div.style.top)-sspeed
    setTimeout("ns6marquee(ns6div)",100)
    }
    else{
    ns6div.style.top=sheight
    ns6div.innerHTML=singletext[i]
    if (i==singletext.length-1)
    i=0
    else
    i++
    }
    }
    // End -->
    </script>

    </HEAD>

    <div align="center">
    <span style="borderWidth:1; borderColor:red; width:350; height:72; background:navy">
    <ilayer id="ns4slider" width="&{swidth};" height="&{sheight};">
    <layer id="ns4slider1" height="&{sheight};" onmouseover="sspeed=0;" onmouseout="sspeed=1">
    <script language="JavaScript">
    if (document.layers)
    document.write(singletext[0])
    </script>
    </layer></ilayer>
    <script language="JavaScript">
    if (document.all){
    document.writeln('<div style="position:relative;overflow:hidden;width:'+swidth+';height:'+sheight+';clip:rect(0 '+swidth+' '+sheight+' 0);border:1 solid red;" onmouseover="sspeed=0;" onmouseout="sspeed=1">')
    document.writeln('<div id="ieslider1" style="position:relative;width:'+swidth+';">')
    document.write(singletext[0])
    document.writeln('</div></div>')
    }
    if(document.getElementById&&!document.all){
    document.writeln('<div style="position:relative;overflow:hidden;width:'+swidth+';height:'+sheight+';clip:rect(0 '+swidth+' '+sheight+' 0);border:1px solid red;" onmouseover="sspeed=0;" onmouseout="sspeed=1">')
    document.writeln('<div id="ns6slider1" style="position:relative;width:'+swidth+';">')
    document.write(singletext[0])
    document.writeln('</div></div>')
    }
    </script></span>
    </div>


    <p><center>
    <font face="arial, helvetica" size"-2"></font>
    </center><p>

    <!-- Script Size: 5.31 KB -->

    So is this even possible or should I be looking for a new script?

    Thanks for any and all replies!
    ~Squishy~

  2. #2
    Join Date
    Jun 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I just realized I may not have posted this in the right forum. Please bear with me as an uber-noob. any direction is appreciated.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Replace:
    Code:
    if (singletext.length>1)
    i=1
    else
    i=0
    With:
    Code:
    i = Math.floor(Math.random() * singletext.length);
    It won't show them in a random order, but it will start at a random place. If you want it to display them randomly as well, you'll have to replace all
    Code:
    if (singletext.length>1)
    i=1
    else
    i=0
    with that line.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jun 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you so much. I'm going to try that right now.

  5. #5
    Join Date
    Jun 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Do I replace:

    if (i==singletext.length-1)
    i=0
    else
    i++

    ...as well? Or just the ones that you stated?

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ack! Sorry, that's the one I intended to paste. My mistake.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Jun 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Alrighty, it works - pretty much. The only thing left that irks me is that it always reverts back to the same quote first. Did I miss something or am I just going to have to live with it that way?

    <!-- Begin
    //slider's width
    var swidth=350

    //slider's height
    var sheight=72

    //slider's speed
    var sspeed=1

    //messages: change to your own; use as many as you'd like; set up Hyperlinks to URLs as you normally do: <a target=... href="... URL ...">..message..</a>
    var singletext=new Array()
    singletext[0]='<div align="center"><font face=Arial size=3 color="white"> quote 1</FONT></div>'
    singletext[1]='<div align="center"><font face=Arial size=3 color="white"> quote 2</font></div>'
    singletext[2]='<div align="center"><font face=Arial size=3 color="white"> quote 3</font></div>'
    singletext[3]='<div align="center"><font face=Arial size=3 color="white"> quote 4</font></div>'
    singletext[4]='<div align="center"><font face=Arial size=3 color="white"> quote 5</font></div>'
    singletext[5]='<div align="center"><font face=Arial size=3 color="white"> quote 6</font></div>'
    singletext[6]='<div align="center"><font face=Arial size=3 color="white"> quote 7</font></div>'
    singletext[7]='<div align="center"><font face=Arial size=3 color="white"> quote 8</font></div>'
    singletext[8]='<div align="center"><font face=Arial size=3 color="white"> quote 9</font></div>'
    singletext[9]='<div align="center"><font face=Arial size=3 color="white"> quote 10</font></div>'
    singletext[10]='<div align="center"><font face=Arial size=3 color="white"> quote 11</font></div>'
    singletext[11]='<div align="center"><font face=Arial size=3 color="white"> quote 12</font></div>'
    i = Math.floor(Math.random() * singletext.length);
    function start(){
    if (document.all){
    ieslider1.style.top=sheight
    iemarquee(ieslider1)
    }
    else if (document.layers){
    document.ns4slider.document.ns4slider1.top=sheight
    document.ns4slider.document.ns4slider1.visibility='show'
    ns4marquee(document.ns4slider.document.ns4slider1)
    }
    else if (document.getElementById&&!document.all){
    document.getElementById('ns6slider1').style.top=sheight
    ns6marquee(document.getElementById('ns6slider1'))
    }
    }
    function iemarquee(whichdiv){
    iediv=eval(whichdiv)
    if (iediv.style.pixelTop>0&&iediv.style.pixelTop<=sspeed){
    iediv.style.pixelTop=0
    setTimeout("iemarquee(iediv)",100)
    }
    if (iediv.style.pixelTop>=sheight*-1){
    iediv.style.pixelTop-=sspeed
    setTimeout("iemarquee(iediv)",100)
    }
    else{
    iediv.style.pixelTop=sheight
    iediv.innerHTML=singletext[i]
    i = Math.floor(Math.random() * singletext.length);
    }
    }
    function ns4marquee(whichlayer){
    ns4layer=eval(whichlayer)
    if (ns4layer.top>0&&ns4layer.top<=sspeed){
    ns4layer.top=0
    setTimeout("ns4marquee(ns4layer)",100)
    }
    if (ns4layer.top>=sheight*-1){
    ns4layer.top-=sspeed
    setTimeout("ns4marquee(ns4layer)",100)
    }
    else{
    ns4layer.top=sheight
    ns4layer.document.write(singletext[i])
    ns4layer.document.close()
    i = Math.floor(Math.random() * singletext.length);
    }
    }
    function ns6marquee(whichdiv){
    ns6div=eval(whichdiv)
    if (parseInt(ns6div.style.top)>0&&parseInt(ns6div.style.top)<=sspeed){
    ns6div.style.top=0
    setTimeout("ns6marquee(ns6div)",100)
    }
    if (parseInt(ns6div.style.top)>=sheight*-1){
    ns6div.style.top=parseInt(ns6div.style.top)-sspeed
    setTimeout("ns6marquee(ns6div)",100)
    }
    else{
    ns6div.style.top=sheight
    ns6div.innerHTML=singletext[i]
    i = Math.floor(Math.random() * singletext.length);
    }
    }
    // End -->
    </script>

    </HEAD>

    <div align="center">
    <span style="borderWidth:1; borderColor:red; width:350; height:72; background:navy">
    <ilayer id="ns4slider" width="&{swidth};" height="&{sheight};">
    <layer id="ns4slider1" height="&{sheight};" onmouseover="sspeed=0;" onmouseout="sspeed=1">
    <script language="JavaScript">
    if (document.layers)
    document.write(singletext[0])
    </script>
    </layer></ilayer>
    <script language="JavaScript">
    if (document.all){
    document.writeln('<div style="position:relative;overflow:hidden;width:'+swidth+';height:'+sheight+';clip:rect(0 '+swidth+' '+sheight+' 0);border:1 solid red;" onmouseover="sspeed=0;" onmouseout="sspeed=1">')
    document.writeln('<div id="ieslider1" style="position:relative;width:'+swidth+';">')
    document.write(singletext[0])
    document.writeln('</div></div>')
    }
    if(document.getElementById&&!document.all){
    document.writeln('<div style="position:relative;overflow:hidden;width:'+swidth+';height:'+sheight+';clip:rect(0 '+swidth+' '+sheight+' 0);border:1px solid red;" onmouseover="sspeed=0;" onmouseout="sspeed=1">')
    document.writeln('<div id="ns6slider1" style="position:relative;width:'+swidth+';">')
    document.write(singletext[0])
    document.writeln('</div></div>')
    }
    </script></

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Hm... shouldn't do. Demo?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jun 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, it wants me to register.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •