...

View Full Version : change the body bgcolor



crmpicco
07-08-2005, 03:28 PM
<script language="javascript">

function HideNPrint() {

PrintMe.style.visibility = "hidden";
print();
PrintMe.style.visibility = "visible";
}
</script>
<body bgcolor="#ececec">

<input type="button" name="Print Breakdown" id="print_breakdown"
value="Print Breakdown" onClick="HideNPrint();" onmouseover="style.cursor='hand'">


is there any way to change the body bgcolor from #ECECEC to #FFFFFF when this button is clicked?

nikkiH
07-08-2005, 03:40 PM
Sure; it's been posted a couple times here. Just search. Last time it was posted was just a few days ago.

But why would you want to do this the hard way?
It appears you're changing this for printing.
Learn CSS. Use the media attribute to specify what to print and in what color. Save yourself some headaches.
http://www.w3.org/TR/REC-CSS2/media.html

crmpicco
07-11-2005, 02:47 PM
This is what i was after.............



<script language="javascript">
function changecolor(code)
{
document.bgColor=code
}
function HideNPrint()
{
PrintMe.style.visibility = "hidden";
print();
PrintMe.style.visibility = "visible";
}


</script>

<body bgcolor="#f5f5f5" alink="#0000ff" link="#0000ff" vlink="#0000ff" onLoad="InitializeTimer();">

.... onClick="changecolor('#FFFFFF');HideNPrint();" .....



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum