faqts : Computers : Programming : Languages : JavaScript

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

28 of 39 people (72%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I change style in tag <div> in IE and NN (setting visibility: show or hidden)

Apr 4th, 2008 21:05
ha mo, Colin Fraser, Stas Saulin,


Sorry, it is about 8 hours later, I thought about what I originally put 
here and realised that the code I gave you is wrong, I can only plead 
that I rushed it. Try this:
<script> <!--
var appn = navigator.appName;
  // Show/Hide functions
  function show(id) {
          if (appn=="Netscape") 
            document.layers[id].visibility = "show"
          else if (appn=="Microsoft Internet Explorer") 
            document.all[id].style.visibility = "visible"
  }
  function hide(id) {
          if (appn=="Netscape") 
            document.layers[id].visibility = "hide"
          else if (appn=="Microsoft Internet Explorer") 
            document.all[id].style.visibility = "hidden"
  }
--> </script>
Then to use these functions in the page: 
  show("divName")
or 
  hide("divName") 
This does work.
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