SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how do I keep the arrays from showing up, if empty?

    thanks for the help earlier. I simplified the code so each description is in an array. however, sometimes the arrays will not have any description, and i need those ones not to show up. How would I stop the blank arrays from showing up? for instance if tickercontents[3] is null,i don't want it to display?

    <style type="text/css">

    #memoryticker{
    background-color: lightyellow;
    width: 800px;
    font: bold 12px Verdana;
    /*Tip: add in height attribute here for multiple line scroller*/
    border: 1px solid black;
    padding: 3px;
    position: absolute; top: 208px; right: 100px;
    /*Change 0.7 below to a different number if desired (0.7=0.7 seconds)*/
    /*Remove below line to remove transitional effect in IE. Below line should always appear last within this CSS*/
    filter: progidXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)
    }

    </style>
    <script type="text/javascript">
    var tickercontents=new Array()

    tickercontents[0]='#thedesc#'
    tickercontents[1]='#thedesc2#'
    tickercontents[2]='#thedesc3#'

    var persistlastviewedmsg=1 //should messages' order persist after users navigate away (1=yes, 0=no)?
    var persistmsgbehavior="onload" //set to "onload" or "onclick".

    //configure the below variable to determine the delay between ticking of messages (in miliseconds):
    var tickdelay=6000

    ////Do not edit pass this line////////////////
    ' <a href="http://www.freewarejava.com">FreewareJava</a>- Free Java applets, tutorials, and resources.</a>'

    var divonclick=(persistlastviewedmsg && persistmsgbehavior=="onclick")? 'onClick="savelastmsg()" ' : ''
    var currentmessage=0

    function changetickercontent(){
    if (crosstick.filters && crosstick.filters.length>0)
    crosstick.filters[0].Apply()
    crosstick.innerHTML=tickercontents[currentmessage]
    if (crosstick.filters && crosstick.filters.length>0)
    crosstick.filters[0].Play()
    currentmessage=(currentmessage==tickercontents.length-1)? currentmessage=0 : currentmessage+1
    var filterduration=(crosstick.filters&&crosstick.filters.length>0)? crosstick.filters[0].duration*1000 : 0
    setTimeout("changetickercontent()",tickdelay+filterduration)
    }

    function beginticker(){
    if (persistlastviewedmsg && get_cookie("lastmsgnum")!="")
    revivelastmsg()
    crosstick=document.getElementById? document.getElementById("memoryticker") : document.all.memoryticker
    changetickercontent()
    }

    function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = ""
    if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) {
    offset += search.length
    end = document.cookie.indexOf(";", offset)
    if (end == -1)
    end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
    }
    }
    return returnvalue;
    }

    function savelastmsg(){
    document.cookie="lastmsgnum="+currentmessage
    }

    function revivelastmsg(){
    currentmessage=parseInt(get_cookie("lastmsgnum"))
    currentmessage=(currentmessage==0)? tickercontents.length-1 : currentmessage-1
    }

    if (persistlastviewedmsg && persistmsgbehavior=="onload")
    window.onunload=savelastmsg

    if (document.all||document.getElementById)
    document.write('<div id="memoryticker" '+divonclick+'></div>')
    if (window.addEventListener)
    window.addEventListener("load", beginticker, false)
    else if (window.attachEvent)
    window.attachEvent("onload", beginticker)
    else if (document.all || document.getElementById)
    window.onload=beginticker

    </script>

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The page is actually a coldfusion page, so is this something i could use coldfusion to control?

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    or is it not possible to keep the blank arrays from showing up?


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
  •