March 12, 2000 - Setting the Background Color | WebReference

March 12, 2000 - Setting the Background Color

Yehuda Shiran March 12, 2000
Setting the Background Color
Tips: March 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

The background color properties are different between the browsers. Internet Explorer uses backgroundColor while Netscape Navigator uses bgColor:

function docjslib_setElementBgColor(id, elementColor) {
  if (NS4) eval(id).bgColor = elementColor
  else eval(id).style.backgroundColor = elementColor;
}

Learn more about DOCJSLIB 4.0 in Column 33, DOCJSLIB Version 4.0: Scrollers, Watermarks, and Games.