Javascript & Netscape

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adam

    Javascript & Netscape

    I have a scrollbar that runs at the top of my page, I have it in a external
    js file and call it in the head tags of the webpage code. can you one tell
    me how to get this code to work with other browsers mainly Netscape 7 and
    above. Currently it doesn't display.

    this is the scroll bar code

    Thanks

    ----------------------------------------------------------------------
    document.write( '<marquee id="alertit"
    style="position :absolute;left: 0px;top:0;backg round-color:"
    onMouseover="th is.scrollAmount =1"
    onMouseout="thi s.scrollAmount= speed"></marquee>');



    var themsg='<span style="font: 22px Arial;color:#FF CC66;"><b>Text Text
    Text:</span>'
    var speed=4
    var loops=4

    function populatescrolle r(){
    var windowwidth=iec ompattest().cli entWidth
    document.getEle mentById("alert it").innerHTML= themsg
    document.getEle mentById("alert it").style.widt h=windowwidth
    document.getEle mentById("alert it").scrollAmou nt=speed
    document.getEle mentById("alert it").scrollDela y=20
    document.getEle mentById("alert it").loop=loo ps
    document.getEle mentById("alert it").onfinish=f unction(){
    document.getEle mentById("alert it").style.visi bility="hidden"
    }
    }

    function iecompattest(){
    return (document.compa tMode!="BackCom pat")? document.docume ntElement :
    document.body
    }

    if (document.all && document.getEle mentById){
    window.onload=p opulatescroller
    window.onresize =populatescroll er
    }
    ----------------------------------------------------------------------


  • Michael Schmitt

    #2
    Re: Javascript &amp; Netscape

    Adam wrote:
    [color=blue]
    > I have a scrollbar that runs at the top of my page, I have it in a external
    > js file and call it in the head tags of the webpage code. can you one tell
    > me how to get this code to work with other browsers mainly Netscape 7 and
    > above. Currently it doesn't display.
    >
    > this is the scroll bar code
    >
    > Thanks
    >
    > ----------------------------------------------------------------------
    > document.write( '<marquee id="alertit"
    > style="position :absolute;left: 0px;top:0;backg round-color:"
    > onMouseover="th is.scrollAmount =1"
    > onMouseout="thi s.scrollAmount= speed"></marquee>');[/color]
    background-color ?[color=blue]
    >
    >
    >
    > var themsg='<span style="font: 22px Arial;color:#FF CC66;"><b>Text Text
    > Text:</span>'[/color]
    var themsg='<span style="font: 22px Arial;color:#FF CC66;font-weight:bold">Te xt Text Text:</span>';[color=blue]
    > var speed=4[/color]
    var speed=4;[color=blue]
    > var loops=4[/color]
    var loops=4;[color=blue]
    >
    > function populatescrolle r(){
    > var windowwidth=iec ompattest().cli entWidth[/color]
    var windowwidth=iec ompattest().cli entWidth;[color=blue]
    > document.getEle mentById("alert it").innerHTML= themsg[/color]
    document.getEle mentById("alert it").innerHTML= themsg;[color=blue]
    > document.getEle mentById("alert it").style.widt h=windowwidth[/color]
    document.getEle mentById("alert it").style.widt h=windowwidth + 'px';[color=blue]
    > document.getEle mentById("alert it").scrollAmou nt=speed[/color]
    document.getEle mentById("alert it").scrollAmou nt=speed;[color=blue]
    > document.getEle mentById("alert it").scrollDela y=20[/color]
    document.getEle mentById("alert it").scrollDela y=20;[color=blue]
    > document.getEle mentById("alert it").loop=loo ps[/color]
    document.getEle mentById("alert it").loop=loops ;[color=blue]
    > document.getEle mentById("alert it").onfinish=f unction(){
    > document.getEle mentById("alert it").style.visi bility="hidden"
    > }[/color]
    This is an unknown, or at least proprietary event and does not work in IE 6 SP1 and Moz. 1.7
    http://groups.google.d e/groups?q=onfini sh+group:comp.l ang.javascript& hl=de&lr=lang_d e|lang_en&ie=UT F-8&group=comp.la ng.javascript&s elm=LQQk4.855%2 4hT2.11777%40ne ws1.rdc1.ct.hom e.com&rnum=4[color=blue]
    > }
    >
    > function iecompattest(){
    > return (document.compa tMode!="BackCom pat")? document.docume ntElement :
    > document.body
    > }
    >[/color]
    The next I changed to a function, which is called by <body onload="setupMa rquee();">
    [color=blue]
    > if (document.all && document.getEle mentById){[/color]

    only IE and Opera know the proprietary document.all
    so e.g. Mozilla and Netscape don't come here
    [color=blue]
    > window.onload=p opulatescroller
    > window.onresize =populatescroll er
    > }[/color]

    function setupMarquee() {
    if (document.all || document.getEle mentById){
    window.onresize =populatescroll er;
    populatescrolle r();
    } else {
    alert('Browser !=IE Browser != Opera');
    }
    }

    After correcting some mistakes this code is working in IE 6.0 SP1 and Mozilla 1,7, hopefully in Opera too.
    But I would apologize to implement your 'scrollbar' with DHTML without the proprietary '<marquee>', or even better
    with one of the free Java-applets.

    cu, Michael

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Javascript &amp; Netscape

      Adam wrote:[color=blue]
      > I have a scrollbar that runs at the top of my page, [...][/color]

      You do not have a scrollbar (that is the GUI element to scroll the
      document), you have horizontally scrolling text. For usabilities
      sake, remove it. (Ask Google for details about "marquee".)


      PointedEars

      Comment

      Working...