![]() |
|
|
|||||||
![]() |
|
|
Thread Tools | Rate Thread |
|
|
PM User | #1 |
|
New Coder ![]() Join Date: Jun 2005
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
document.body.style.filter not working for firefox
hi there,
in need to change the html page color as grey with the help of my javascript function. I am using "document.body.style.filter='grey'"; and this is working fine with IE. But it is not working with Firefox. Please help me to find out the replacement for this command. thank you guys |
|
|
|
|
|
PM User | #2 |
|
Senior Coder ![]() Join Date: Feb 2003
Posts: 1,665
Thanks: 0
Thanked 27 Times in 25 Posts
![]() |
As you've probably worked out, the css filter attribute is MSIE5.5+ only.
There is a more appropriate attribute to use: background-color. Here's an example of how to change the body element's background-color. (Note that attributes with compound/hyphenated names are represented in javascript with the hyphen removed and the second word capitalised.) e.g. Code:
function changeBG() {
var myBody = document.getElementsByTagName("body");
myBody[0].style.backgroundColor = "gray";
}
Code:
<a href="#" onclick="changeBG(); return false;">Change background colour to gray</a> |
|
|
|
|
|
PM User | #3 |
|
New Coder ![]() Join Date: Jun 2005
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
hi,
i am not trying to make all the background color as grey. just i am trying to make the font color of the body content as grey..... the code which i am working is fine with IE but it is not working with firefox.... please help me... thank you in advance |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Rate This Thread | |
|
|