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

Michael Vincent mv_van_rantwijk at yahoo.com
Tue Aug 16 14:28:43 EDT 2005

Philip Chee wrote:
> On Tue, 16 Aug 2005 00:40:21 +0200, Michael Vincent 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?
> ?For IE Perhaps?:

Yes, that's MicroSoft Internet Explorer

> myDiv.style.propertyName or
> document.all["myDiv"].style.propertyName

Ah, that works like a charm. Thanks Philip!

> Don't know if these will help but:


Not at this moment because I still have reading/concentration troubles 
because of my medication :(

Do you know how this can be fixed? It should work with Mozilla and MSIE

tr.setAttribute("class", "selected");

Thanks for your help,

More information about the Project_owners mailing list