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?

14 of 22 people (64%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How to get a specific Table Cell <TD> to change bgcolor from an IF ELSE statement?

Apr 6th, 2008 19:52
ha mo, Randy Harmelink, William Hargrave,


Is this the type of code you're looking for?
<TABLE><TR><TD id=C1>Cell 1</TD><TD id=C2>Cell 2</TD></TR></TABLE>
<SCRIPT>
   var Test = 1;
   if (Test == 1) {
      C1.style.backgroundColor = "red";
      C2.style.backgroundColor = "green";
   } else {
      C1.style.backgroundColor = "blue";
      C2.style.backgroundColor = "black";
      }
   </SCRIPT>
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