Web Analytics Made Easy -
StatCounter Hide/Show a div in Opera - CodingForum

Announcement

Collapse
No announcement yet.

Hide/Show a div in Opera

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hide/Show a div in Opera

    How can I show/hide a DIV in Opera 6+?For Mozilla,Konqueror and IE its: document.getelementbyid("test").style.visibility="hidden";
    Thanks in advance.

  • #2
    I always assumed that:

    document.getElementById('nodeID').style.visibility = 'hidden';

    Would work in Opera. Opera does not support any dynamica manipulations to the page's document structure, but I know you can hide/show nodes, as some menus work in Opera,

    Perhaps using style.display = 'none' instead would work? Brothercake (a forum member) should know, as I believe he wrote a menu that works in Opera...
    jasonkarldavis.com

    Comment


    • #3
      Try the script that Adios gave me in the link below (2nd last post). It works in Opera6 Win98 unless I change the style to display.

      http://www.codingforum.net/ubb/Forum1/HTML/025905.html

      Comment


      • #4
        Both display and visibility are supported by opera, and the getElementById technique is the right one.

        It must be something else - can you show us the script.
        "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

        Comment


        • #5
          I was trying to make the script I found on http://www.geocities.com/x_goose_x/tree/compiler.htm work in Opera6.It uses style.display but it doesnt work in Opera.

          Comment


          • #6
            Thanks Brothercake.

            It must be something else I'm doing.

            Comment


            • #7
              Well maybe not actually - it appears I spoke to soon

              Playing with that script, I couldn't get it to work either, for no readily apparent reason, so I looked into Opera's JS specs http://www.opera.com/docs/specs/js/ and display doesn't appear; it doesn't say it isn't supported but it doesn't say it is either. Querying the obj.style.display returned undefined, so maybe display just isn't supported after all

              sorry for any confusion ...
              "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

              Comment


              • #8
                The menus on this site (CBS.SportsLine.com) work in Opera 6, so presumably it must be supported to some extent. All the code is embedded in the document, though I've not had a chance to study it yet (there's a lot of it).

                I was always led to believe that Opera didn't support dynamic modification of pages, so I was pretty surprised when I came across this.

                BL
                "nam et ipsa scientia potentas est" - Francis Bacon

                Comment


                • #9
                  Hmmmmm.......so should I just use visibility then instead of setting display to none?

                  Comment


                  • #10
                    Well this much is certain - dynamic modification of elements is not supported in Opera - that menu you linked to uses visibility, which is not the same thing as display.

                    Visibility is supported in Opera - check out http://www.brothercake.com/dropdown/ in opera to see how it can be used to make a menu system - but for a collapse/expand style nav then display would be needed, so it may not (probably wont) work in Opera. I'll do some tests and confirm support/lack of support for this property shortly
                    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

                    Comment

                    Working...
                    X