Faqts : Computers : Programming : Shopping For You : JavaScript

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

32 of 66 people (48%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How to change the visibility of a DIV in NN6 if myDiv.style.visibility = "visible" doesn't work?

Apr 4th, 2008 21:16
ha mo, Colin Fraser, Brock Sperryn,


I know this may seem a little dumb but try 
  document.divName.visibility = "show"
and to hide it's: 
  document.divName.visibility = "hide"
for Netscape and for Internet Explorer try : 
  divName.style.visibility = "visible"
and to hide it's: 
  divName.style.visibility = "hidden"
Both major browsers used different approaches to such issues and require 
different techniques to execute them properly. To determine which 
browser your user is using you may want to try : 
  ie = (document.all)? true:false
  ns = (document.layers)? true:false
Microsoft used the all object and Netscape used the layers object, by  
creating a boolean variable and assigning the appropriate value 
depending on which browser is being used you can execute any fuction 
based on which browser is being used with the code : 
  function dosomething() {
          if (ns) {
                  // do something in Netscape
          }
          if (ie) {
                  // do something else in Internet Explorer
          } 
This is adding cross-browser functionality to your code. There are other 
ways of couse, but I have found this the simplest, just exploit the 
differences, not worry about them.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com