|
|
changing the background color of the page - (document.bgcolor) - HTML
|
Views : 375
|
|
Tagged in : HTML
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
The easiest way to change the background color of a page is using the property bgcolor.
document.bgColor="green";
Example: Code
<script language=javascript>
document.write("<input type=button value=red onclick=bgc()>");
function bgc(){
alert("sdsd");
document.bgColor="#e1FFE1";
}
</script>
But note that you have to set the color to the proper element. If there are elements like table which are above the document with color set on it, this wont work.
Then you will have to use something like
document.getElementById('<element id>').bgColor="green";
|
|
By - Sanju, On - 2010-02-05 |
|
|
|