W3C home > Mailing lists > Public > www-style@w3.org > February 2001

NS Prob. Set TD bgcolor w/JS

From: Handeland, Jarle <jarle.handeland@capgemini.no>
Date: Thu, 15 Feb 2001 15:56:51 +0100
Message-ID: <086757ACB14DD211A2B900805FBB0B8D074046DF@OSL01>
To: "'www-style@w3.org'" <www-style@w3.org>
Hi!
 
The syntax in the "if (ns4)" case below doesn't work. Does anybody know why?
(Can't set a td background color in ns4+. What's the syntax?)
 
Another question: Where can I find a referance like this one xxx only it's
for Netscape?
 
 
  var ns4 = (document.layers)? true:false
  var ie4 = (document.all)? true:false
  var iSelTab = -1; var selColor = "#FFCC99"; var unSelColor = "#CCCCCC";
  function selTab(j) {
   if (j!=iSelTab) {
          if (ns4) {
     eval("document.layers[t"+j+"].backgroundColor = selColor");
     eval("document.i"+j+".src = 'tabSel.gif'");
     if (iSelTab>-1) {
      eval("document.layers[t"+iSelTab+"].backgroundColor = selColor");
      eval("document.i"+iSelTab+".src = 'tabSel.gif'");
     }
          } else if (ie4) {
     document.all["t"+j].style.backgroundColor = selColor;
     document.all["i"+j].src = "tabSel.gif";
     if (iSelTab>-1) {
      document.all["t"+iSelTab].style.backgroundColor = unSelColor;
      document.all["i"+iSelTab].src = "tab.gif";     
     }
    }
    iSelTab = j;
   }
  }
Received on Thursday, 15 February 2001 09:57:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:08 GMT