Why wont JS script trigger on mouse-over in NS and Mozilla

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • news frontiernet.net

    #1

    Why wont JS script trigger on mouse-over in NS and Mozilla

    I have a project that uses mouse-over JS script to show and hide layers that
    works well in MSIE 6.0 and Opera.

    But, it does not work in NS nor Mozilla.

    It is here: http://www.wgtn.net/Business/category_layer.htm

    A mouse-over of any of the letters in that left vertical panel of letters
    shoud trigger a JS script that shows the appropriate panel on the right.

    The code pases HTML and CSS validation.

    What could be inhibiting the mouse-over trigger in NS and Mozilla?


  • David Dorward

    #2
    Re: Why wont JS script trigger on mouse-over in NS and Mozilla

    news frontiernet.net wrote:
    [color=blue]
    > I have a project that uses mouse-over JS script to show and hide layers
    > that works well in MSIE 6.0 and Opera.
    >
    > But, it does not work in NS nor Mozilla.
    >
    > It is here: http://www.wgtn.net/Business/category_layer.htm[/color]

    It is being triggered. You test for document.all, which is a non-standard
    DOM supported by IE and Opera, then you test for document.layers , which is
    a non-standard DOM supported by Netscape 4.x. Then you give up.

    Try using the standard:


    (Note that you'll want to use the ECMA Script Language Binding to DOM 1 for
    this)

    --
    David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is

    Comment

    • Dag Sunde

      #3
      Re: Why wont JS script trigger on mouse-over in NS and Mozilla

      "news frontiernet.net " <rfrohrer@rconn ect.com> wrote in message
      news:J015d.7236 $8n7.6878@news0 2.roc.ny...[color=blue]
      > I have a project that uses mouse-over JS script to show and hide layers[/color]
      that[color=blue]
      > works well in MSIE 6.0 and Opera.
      >
      > But, it does not work in NS nor Mozilla.
      >
      > It is here: http://www.wgtn.net/Business/category_layer.htm
      >
      > A mouse-over of any of the letters in that left vertical panel of letters
      > shoud trigger a JS script that shows the appropriate panel on the right.
      >
      > The code pases HTML and CSS validation.
      >
      > What could be inhibiting the mouse-over trigger in NS and Mozilla?
      >[/color]

      Skip this:

      if (document.layer s && document.layers[object]) {
      document.layers[object].visibility = 'visible';
      }
      else if (document.all) {
      document.all[object].style.visibili ty = 'visible';
      }

      and replace it with this:
      if( document.getEle mentById )
      document.getEle mentById(object ).style.visibil ity = 'visible';
      else
      alert("Please download a decent Standard compliant browser!");


      What you do is some half-hearted IE/Opera and NS4 testing (Both
      non-standard).
      document.getEle mentById(...) is supported by all the browsers worth worrying
      about. (NS 4.x is NOT one of them!)

      --
      Dag
      58°26'15.9" N 008°46'45.5" E


      Comment

      • news frontiernet.net

        #4
        Re: Why wont JS script trigger on mouse-over in NS and Mozilla

        Thanks!

        That does make the trigger work for NS too.

        However there seems to still be an oddity. While the trigger works going
        DOWN the panel of letters, settin each corresponding layer to visible and
        displaying the correct material for that letter. It doesnt work in NS going
        back UP the panel of letters. It works in MSIE.

        Are there other browser specific errors with this JS script that are causing
        this?



        "Dag Sunde" <ds@orion.no-way> wrote in message
        news:Z625d.212$ HA5.20858@julie tt.dax.net...[color=blue]
        > "news frontiernet.net " <rfrohrer@rconn ect.com> wrote in message
        > news:J015d.7236 $8n7.6878@news0 2.roc.ny...[color=green]
        > > I have a project that uses mouse-over JS script to show and hide layers[/color]
        > that[color=green]
        > > works well in MSIE 6.0 and Opera.
        > >
        > > But, it does not work in NS nor Mozilla.
        > >
        > > It is here: http://www.wgtn.net/Business/category_layer.htm
        > >
        > > A mouse-over of any of the letters in that left vertical panel of[/color][/color]
        letters[color=blue][color=green]
        > > shoud trigger a JS script that shows the appropriate panel on the right.
        > >
        > > The code pases HTML and CSS validation.
        > >
        > > What could be inhibiting the mouse-over trigger in NS and Mozilla?
        > >[/color]
        >
        > Skip this:
        >
        > if (document.layer s && document.layers[object]) {
        > document.layers[object].visibility = 'visible';
        > }
        > else if (document.all) {
        > document.all[object].style.visibili ty = 'visible';
        > }
        >
        > and replace it with this:
        > if( document.getEle mentById )
        > document.getEle mentById(object ).style.visibil ity = 'visible';
        > else
        > alert("Please download a decent Standard compliant browser!");
        >
        >
        > What you do is some half-hearted IE/Opera and NS4 testing (Both
        > non-standard).
        > document.getEle mentById(...) is supported by all the browsers worth[/color]
        worrying[color=blue]
        > about. (NS 4.x is NOT one of them!)
        >
        > --
        > Dag
        > 58°26'15.9" N 008°46'45.5" E
        >
        >[/color]


        Comment

        • Lee

          #5
          Re: Why wont JS script trigger on mouse-over in NS and Mozilla

          news frontiernet.net said:[color=blue]
          >
          >Thanks!
          >
          >That does make the trigger work for NS too.
          >
          >However there seems to still be an oddity. While the trigger works going
          >DOWN the panel of letters, settin each corresponding layer to visible and
          >displaying the correct material for that letter. It doesnt work in NS going
          >back UP the panel of letters. It works in MSIE.
          >
          >Are there other browser specific errors with this JS script that are causing
          >this?[/color]

          You need to fix your "hide()" function, too.
          Currently, it's never hiding any layer, so once a layer has been
          made visible, there's no way to see any "lower" layer.

          Comment

          • news frontiernet.net

            #6
            Re: Why wont JS script trigger on mouse-over in NS and Mozilla

            Yes !!!

            That works!

            I am a cut-n-paste js script user. That script has been around a while.

            Thank you!

            "Lee" <REM0VElbspamtr ap@cox.net> wrote in message
            news:cj2n4t011i g@drn.newsguy.c om...[color=blue]
            > news frontiernet.net said:[color=green]
            > >
            > >Thanks!
            > >
            > >That does make the trigger work for NS too.
            > >
            > >However there seems to still be an oddity. While the trigger works going
            > >DOWN the panel of letters, settin each corresponding layer to visible and
            > >displaying the correct material for that letter. It doesnt work in NS[/color][/color]
            going[color=blue][color=green]
            > >back UP the panel of letters. It works in MSIE.
            > >
            > >Are there other browser specific errors with this JS script that are[/color][/color]
            causing[color=blue][color=green]
            > >this?[/color]
            >
            > You need to fix your "hide()" function, too.
            > Currently, it's never hiding any layer, so once a layer has been
            > made visible, there's no way to see any "lower" layer.
            >[/color]


            Comment

            • Lasse Reichstein Nielsen

              #7
              Re: Why wont JS script trigger on mouse-over in NS and Mozilla

              "news frontiernet.net " <rfrohrer@rconn ect.com> writes:
              [color=blue]
              > I am a cut-n-paste js script user. That script has been around a while.[/color]

              And it shows!
              That script was probably created four or five years ago, back when the only
              browsers being recognized was IE 4 and Netscape 4. Luckily, we are long
              past that, but some scripts fail to retire gracefully :)
              /L
              --
              Lasse Reichstein Nielsen - lrn@hotpop.com
              DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
              'Faith without judgement merely degrades the spirit divine.'

              Comment

              • Thomas 'PointedEars' Lahn

                #8
                Re: Why wont JS script trigger on mouse-over in NS and Mozilla

                David Dorward wrote:
                [color=blue]
                > news frontiernet.net wrote:[color=green]
                >> I have a project that uses mouse-over JS script to show and hide layers
                >> that works well in MSIE 6.0 and Opera.
                >>
                >> But, it does not work in NS nor Mozilla.
                >> [...][/color]
                >
                > [...]
                > Try using the standard:
                > http://w3.org/TR/1998/REC-DOM-Level-1-19981001/[/color]

                You are a bit behind time.
                [color=blue]
                > (Note that you'll want to use the ECMA Script Language Binding to DOM 1
                > for this)[/color]

                No, he does not want that, for there is no _ECMAScript_ Language Binding
                for (Cascading) Style Sheets in DOM Level 1, in contrast to DOM Level 2:

                <http://www.w3.org/TR/DOM-Level-2/>
                <http://www.w3.org/TR/DOM-Level-2-HTML/>
                <http://www.w3.org/TR/DOM-Level-2-Style/>


                PointedEars
                --
                Can't you hear Moe saying this "That's real good... if you like crap!"

                Comment

                Working...