Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. javascript document.all error in firefox for asp:panel

javascript document.all error in firefox for asp:panel

Scheduled Pinned Locked Moved Web Development
javascripthelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Travelthrprog
    wrote on last edited by
    #1

    Hi all, I am trying to access the asp:panel Id inside the javascript like this document.all("panel2") and it works fine in IE browser. But with firefox this is errors out. I tried var panelvar= document.all("panel2")||document.getelementbyid("panel2) it failed Any suggesionts please...... code

    T 1 Reply Last reply
    0
    • T Travelthrprog

      Hi all, I am trying to access the asp:panel Id inside the javascript like this document.all("panel2") and it works fine in IE browser. But with firefox this is errors out. I tried var panelvar= document.all("panel2")||document.getelementbyid("panel2) it failed Any suggesionts please...... code

      T Offline
      T Offline
      Travelthrprog
      wrote on last edited by
      #2

      Never mind I found the solution var ie=document.all; if (ie) document.all("Panel2").style.display = "none"; :)else document.getElementById("Panel2").style.display="none"; code

      G 1 Reply Last reply
      0
      • T Travelthrprog

        Never mind I found the solution var ie=document.all; if (ie) document.all("Panel2").style.display = "none"; :)else document.getElementById("Panel2").style.display="none"; code

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        Don't write special code for IE. Just use the standard compliant code, that works just fine in IE too: document.getElementById("Panel2").style.display="none";

        --- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams

        N 1 Reply Last reply
        0
        • G Guffa

          Don't write special code for IE. Just use the standard compliant code, that works just fine in IE too: document.getElementById("Panel2").style.display="none";

          --- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams

          N Offline
          N Offline
          nirmalamari
          wrote on last edited by
          #4

          Hi Guffa, Thanks for taking ur time to reply. Since panel is a asp control, IE used document.all to retreive the id. Crazy syntax. This has been done to differentiate between asp control and html control code

          G 1 Reply Last reply
          0
          • N nirmalamari

            Hi Guffa, Thanks for taking ur time to reply. Since panel is a asp control, IE used document.all to retreive the id. Crazy syntax. This has been done to differentiate between asp control and html control code

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            nirmalamari wrote:

            Since panel is a asp control, IE used document.all to retreive the id. Crazy syntax. This has been done to differentiate between asp control and html control

            That doesn't really make any sense. It doesn't matter how the html code is generated on the server, in the browser it's all html elements. You can't access the panel in the browser, as there is no panel in the page. What you access is the div element that the panel has rendered in the html code. There is no panel. :)

            --- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups