Forum : Bg-Fg property
Brief description  about Online courses   join in Online courses
View Santosh  Hegde 's Profile

Bg-Fg property

Dear Sir,
now i taken My first Javascript assignment.
Now i need to know that, there is any way to change Background color and Foreground color in the content? i have designed a page, i tried many things with which is given in the tutorial.
its works only in body section, if without any other content.
please guide me.

Thanks
Asked by Santosh Hegde | Oct 21, 2010 |  Reply now
Replies (2)
View santosh hegde 's Profile
Thank you Sir,
it was for my first Assignment purpose(javascript Basic), But i did it and uploaded already...!!
Thank you again..
Oct 26, 2010
View teacher siliconindia 's Profile
Hi Santosh,

Use document.bgColor to change background color of webpage, and document.fgColor to change text color of webpage....

But both above functions are outdated... U can do this with stylesheets.. call different style id's or classes according to ur requirement using javascript. OR

use, for Eg.
document.getElementById("ID Name").style.backgroundColor="#FF4000";
Oct 24, 2010