Bug with firefox

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

    Bug with firefox

    I needed to hide and show som DIV sections,

    There are many scripts on the net for this. I downloaded that allows
    me to open a hidden DIV from inside a DIV than is itself hidden. This
    accomplished I was pleased with my work.

    That was until I saw the mess in Firefox which ignores everything I
    tell it to do and opens all the DIVs regardless on load. Forgetting
    the browser war jargon as to why Firefox would release a program that
    doesn't work with common code I just need a way of doing this so it
    works in Firefox AND MSIE and anything else out there.

    function InsertContentme d(tid) {
    if (
    document.getEle mentById(tid).s tyle.display == "none") {
    document.getEle mentById(tid).s tyle.display = "";
    document.regfrm s.cgfnm.focus() ;
    }
    else {
    document.getEle mentById(tid).s tyle.display = "none";
    }
    }

    I am opening and closing a hidden DIV with a click call. (It opens it
    when it is closed and it closes it when it is open, The other standard
    way of doing this does not work for me as I need this to work from
    withing a parent DIV that is itself opened by another Javascript
    function.

    Any and all help greatly appreciated

    Garry Jones
    Sweden
  • GarryJones

    #2
    Re: Bug with firefox

    Solved!

    I was having trouble earlier when I wrote this code so I changed a
    couple of <DIVtags to <ptags. It was these that were faulting.

    Firefox does not allow <ptags to have a [ style="display: none" ]
    component. Strange but true, when turned back to DIV it works
    perfectly (even on MSIE). I dread to see my site on other browsers but
    know I must......

    Sorry to have disturbed you good people.....

    However, a wider issue and OT but these differing Internet browsers
    are a headache, rather like a country allowing people to drive on the
    left and ride side of the road at the same time. I dont care which one
    but wouldn't life be jollier if all the companies making browsers bar
    one gave up and deleted their products? What's the point of more than
    one?

    Cheers
    Garry Jones
    Sweden


    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Bug with firefox

      GarryJones wrote:
      Solved!
      It only seems so. You have merely found a workaround to the problem as
      caused by the insufficient analysis of it.
      I was having trouble earlier when I wrote this code so I changed a couple
      of <DIVtags to <ptags. It was these that were faulting.
      Unlikely. Chances are that <http://validator.w3.or g/would have shown
      nesting errors.
      Firefox does not allow <ptags to have a [ style="display: none" ]
      component.
      Nonsense.
      Strange but true, when turned back to DIV it works perfectly (even on
      MSIE).
      Which would indicate instead that either your markup or your script so far
      is of poor quality, for <p style="display: none">...</pworks fine in my Fx
      3.0.1 and all other CSS-capable UAs.
      Sorry to have disturbed you good people.....
      Don't be sorry for *that*.


      PointedEars
      --
      Use any version of Microsoft Frontpage to create your site.
      (This won't prevent people from viewing your source, but no one
      will want to steal it.)
      -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

      Comment

      • Arun

        #4
        Re: Bug with firefox

        Firefox does not allow <ptags to have a [ style="display: none" ]
        component.
        >
        Nonsense.
        I agree with PointedEars. This claim is completely untrue. I wrote
        the
        following program and it works perfectly on all browsers I tested it
        on.

        ...
        <head>
        ...
        <script type="text/javascript" language="JavaS cript">
        function toggle_containe r(id)
        {
        var container = document.getEle mentById(id);
        container.style .display = (container.styl e.display == "")
        ? "none" : "";
        }
        </script>
        </head>
        <body>
        ...
        <a href="javascrip t:void(0);"
        onclick="toggle _container('som e_text');">Togg le</a>
        <p id="some_text" style="display: ;">Hello there</p>
        ...
        </body>
        ...

        Strange but true, when turned back to DIV it works perfectly (even on
        MSIE).
        >
        Which would indicate instead that either your markup or your script so far
        is of poor quality, for <p style="display: none">...</pworks fine in my Fx
        3.0.1 and all other CSS-capable UAs.
        I'd like to add that I checked this code on IE(5,6,7,8b) and
        Firefox(infancy-3.0),
        after all, checking for browser compatibility is kinda part of my job.

        Comment

        • Steve

          #5
          Re: Bug with firefox

          On Aug 31, 11:39 pm, GarryJones <mor...@algonet .sewrote:
          However, a wider issue and OT but these differing Internet browsers
          are a headache, rather like a country allowing people to drive on the
          left and ride side of the road at the same time. I dont care which one
          but wouldn't life be jollier if all the companies making browsers bar
          one gave up and deleted their products? What's the point of more than
          one?
          >
          No it wouldn't. Especially if the one that remains was IE.

          Cheers
          Steve Young
          Austria

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: Bug with firefox

            Arun wrote:
            ^^^^^^^^^^^
            You are encouraged to shorten the attribution line to ease reading, but
            please do not remove it.
            >>Firefox does not allow <ptags to have a [ style="display: none" ]
            >>component.
            >Nonsense.
            >
            I agree with PointedEars. This claim is completely untrue. I wrote
            the following program and it works perfectly on all browsers I tested
            it on.
            Even though it is error-prone and invalid ;-)
            [...]
            <script type="text/javascript" language="JavaS cript">
            ^^^^^^^^^^^^^^^ ^^^^^^
            The `language' attribute is deprecated and unnecessary nowadays.
            [...]
            <a href="javascrip t:void(0);"
            ^^^^^^^^^^^^^^^ ^^^^
            You should not do that, see <http://jibbering.com/faq/#FAQ4_24>.
            onclick="toggle _container('som e_text');">Togg le</a>
            ^
            There is where the `return' statement belongs.
            <p id="some_text" style="display: ;">Hello there</p>
            ^^^^^^^^^
            There you may have syntactically Valid markup, but not Valid CSS;
            in a CSS property declaration, the property value is *required*.

            <http://jigsaw.w3.org/css-validator/>


            HTH

            PointedEars
            --
            var bugRiddenCrashP ronePieceOfJunk = (
            navigator.userA gent.indexOf('M SIE 5') != -1
            && navigator.userA gent.indexOf('M ac') != -1
            ) // Plone, register_functi on.js:16

            Comment

            • slebetman

              #7
              Re: Bug with firefox

              On Sep 2, 4:03 am, Steve <stephen.jo...@ googlemail.comw rote:
              On Aug 31, 11:39 pm, GarryJones <mor...@algonet .sewrote:
              >
              However, a wider issue and OT but these differing Internet browsers
              are a headache, rather like a country allowing people to drive on the
              left and ride side of the road at the same time. I dont care which one
              but wouldn't life be jollier if all the companies making browsers bar
              one gave up and deleted their products? What's the point of more than
              one?
              >
              No it wouldn't. Especially if the one that remains was IE.
              >
              Actually quite a few people think it would. Which is why there are
              efforts to embed Mozilla in IE:



              So now you can use xpath in IE -- HA!

              Comment

              • SAM

                #8
                Re: Bug with firefox

                GarryJones a écrit :
                >
                Firefox does not allow <ptags to have a [ style="display: none" ]
                That's new ?

                My Fx.3 accepts this attribute with div or p

                Comment

                • Steve

                  #9
                  Re: Bug with firefox

                  On Sep 2, 12:49 am, slebetman <slebet...@gmai l.comwrote:
                  On Sep 2, 4:03 am, Steve <stephen.jo...@ googlemail.comw rote:
                  >
                  On Aug 31, 11:39 pm, GarryJones <mor...@algonet .sewrote:
                  >
                  However, a wider issue and OT but these differing Internet browsers
                  are a headache, rather like a country allowing people to drive on the
                  left and ride side of the road at the same time. I dont care which one
                  but wouldn't life be jollier if all the companies making browsers bar
                  one gave up and deleted their products? What's the point of more than
                  one?
                  >
                  No it wouldn't. Especially if the one that remains was IE.
                  >
                  Actually quite a few people think it would. Which is why there are
                  efforts to embed Mozilla in IE:
                  >
                  There now exist ecmaScript and W3C DOM standards. Yet even though
                  Microsoft sit on these committees they still do not implement these
                  standards in IE when the don't feel like it. That is the main cause of
                  your browser problem.

                  If there was a sports competition where one side made up it's own
                  rules as it went along, would it be fair to disqualify all of the
                  other teams that play by the agreed rules?

                  Regards, Steve.

                  Comment

                  • Arun

                    #10
                    Re: Bug with firefox

                    Thomas 'PointedEars' Lahn <PointedE...@we b.dewrote:
                    Even though it is error-prone and invalid ;-)
                    I agree that the code is error-prone but is sufficient as an example.
                     <script type="text/javascript" language="JavaS cript">
                    >
                                                      ^^^^^^^^^^^^^^^ ^^^^^^
                    The `language' attribute is deprecated and unnecessary nowadays.
                    >
                    Because the `language' attribute is deprecated, it doesn't mean that
                    it
                    might not work. It is mainly there for backward compatibility. People
                    still
                    use browsers that can not evaluate MIME-types in attribute values.
                    >
                    [...]
                     <a href="javascrip t:void(0);"
                    >
                                ^^^^^^^^^^^^^^^ ^^^^
                    You should not do that, see <http://jibbering.com/faq/#FAQ4_24>.
                    >
                    onclick="toggle _container('som e_text');">Togg le</a>
                    >
                    ^
                    There is where the `return' statement belongs.
                    >
                    Thanks for the link. I never knew all that stuff. I'll be sure to
                    clean up my act in days to come.

                    Thanks again,
                    Arun

                    Comment

                    • Dr J R Stockton

                      #11
                      Re: Bug with firefox

                      In comp.lang.javas cript message <48BC643E.90709 09@PointedEars. de>, Mon,
                      1 Sep 2008 23:53:02, Thomas 'PointedEars' Lahn <PointedEars@we b.de>
                      posted:
                      >Arun wrote:
                      >^^^^^^^^^^^
                      >You are encouraged to shorten the attribution line to ease reading, but
                      >please do not remove it.
                      The OP is encouraged to ignore your various manias, Herr KontrolleFreak,
                      and to use a decently informative attribution line, as has (as you know)
                      been recommended by those who are mote intelligent, mature, and
                      experienced than yourself.

                      --
                      (c) John Stockton, nr London UK. replyYYWW merlyn demon co uk Turnpike 6.05.
                      Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html-Timo Salmi: Usenet Q&A.
                      Web <URL:http://www.merlyn.demo n.co.uk/news-use.htm: about usage of News.
                      No Encoding. Quotes precede replies. Snip well. Write clearly. Mail no News.

                      Comment

                      • Thomas 'PointedEars' Lahn

                        #12
                        Re: Bug with firefox

                        Arun wrote:
                        Thomas 'PointedEars' Lahn <PointedE...@we b.dewrote:
                        >Even though it is error-prone and invalid ;-)
                        >
                        I agree that the code is error-prone but is sufficient as an example.
                        There is a contradiction.
                        >> <script type="text/javascript" language="JavaS cript">
                        > ^^^^^^^^^^^^^^^ ^^^^^^
                        >The `language' attribute is deprecated and unnecessary nowadays.
                        >
                        Because the `language' attribute is deprecated, it doesn't mean that
                        it might not work.
                        It makes no difference but in MSHTML with the value of "VBScript", and in
                        Mozilla with the value of "JavaScript1.2" .
                        It is mainly there for backward compatibility.
                        Backwards compatibility to an obsolete standard that did not even define the
                        attribute in the first place? Think again.
                        People still use browsers that can not evaluate MIME-types in attribute values.
                        Name one.

                        Besides, it does not matter whether they can "evaluate MIME-types in
                        attribute values". Where the `type' attribute is ignored, an ECMAScript
                        implementation is the default (because at the time of shipping only
                        available) client-side scripting language. Where it is not, the HTML 4.01
                        standard was implemented.


                        PointedEars
                        --
                        Prototype.js was written by people who don't know javascript for people
                        who don't know javascript. People who don't know javascript are not
                        the best source of advice on designing systems that use javascript.
                        -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

                        Comment

                        Working...