javascript document.all error in firefox for asp:panel
-
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
-
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
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
-
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
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
-
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
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
-
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
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