faqts : Computers : Programming : Languages : JavaScript : Document

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

21 of 27 people (78%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How can I change the display element of an attribute?

Apr 2nd, 2000 06:13
Martin Honnen, Nathan Wallace, Martin Honnen


NN4 doesn't allow you to change the display attribute of an element with
javascript.

In IE4+ you can use:

    document.all['elementID'].style.display = 'none'/'inline'/'block' 

With NN6 you can use
    document.getElementById('elementID').style.display =
       'none'/'inline'/'block'

Taken together you can script
  
     var el = 
       document.all ? document.all['elementID'] :
       document.getElementById ? document.getElementById('elementID') :
       null;
     if (el)
       el.style.display = 'none'/'inline'/'block'