changing the background colour of a element in a page

Giganews Newsgroups
Subject: changing the background colour of a element in a page
Posted by:  John D (j.dobs…@find-a-part.com)
Date: Fri, 18 Jul 2003

I am trying to change the background colour of either a div or a textarea
with javascript, but am having problems.

I have passed a hex colour value in the variable hval, and with the
following code can change the background colour of the whole page, but only
(now) want to change either a textarea of  a form or a div.

I'm stuck.

  document.bgColor = hval;

I'm wondering if it is something to do with style.backgroundColor, but am
not sure how to implement it...

John

Replies