[Project_owners] How to hide a <div> in JS

Eric Jung grimholtz at yahoo.com
Tue Aug 16 18:55:48 EDT 2005


Sorry, they're not <div/> but <li/> however the same technique should
work fine for <div/>

--- Michael Vincent <mv_van_rantwijk at yahoo.com> wrote:

> I need to hide a <div> element on a web page in JavaScript. The 
> following code works with Mozilla:
> 
> <script language="JavaScript1.2">
> <!--
> var myDiv = document.getElementById("MyDiv");
> myDiv.setAttribute("style", "display: none;");
> //-->
> </script>
> 
> but it fails to work in MSIE. What do I need to make it work with
> MSIE 
> as well?
> 
> I use <script language="JavaScript1.2"> instead of <script 
> type="application/x-javascript"> or nothing worked in that script
> block. 
> Note that document.getElementById("MyDiv"); returns [object]
> 
> Thanks,
> Michael
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Project_owners mailing list