Click to See Complete Forum and Search --> : Hiding Buttons when printing


Goodz13
January 29th, 2003, 12:10 PM
I have a page with a form with input type text, select, etc.

What I want to know is how do you hide butons and submit buttons.

I found the following code, but it doesn't seem to work

in my head tags.

<style type="text/css" media="print">
<!--
.hide {display:none}
-->
</style>
<style type="text/css" media="screen">
<!--
.hide {display:block}
--></style>


the buttons that I wish to hide.


<span id="hide">
<Input Type="Submit" name="SUBMIT" value="CHOICE">
<Input Type="Submit" name="SUBMIT" value="VIEW">
<Input Type="Submit" name="SUBMIT" value="SAVE">
<Input Type="Button" value="PRINT" onClick="window.print()">
<Input Type="Button" value="EXIT" onClick="window.close()">
</span>


Is there any other way, preferably without showing and hiding DIV tags?:confused:

Goodz13
January 29th, 2003, 12:33 PM
This worked!

The header is the same as above.


<div class="hide">
<Input Type="Submit" name="SUBMIT" value="CHOICE">
<Input Type="Submit" name="SUBMIT" value="VIEW">
<Input Type="Submit" name="SUBMIT" value="SAVE">
<Input Type="Button" value="PRINT" onClick="window.print()">
<Input Type="Button" value="EXIT" onClick="window.close()">
</div>

vickers_bits
February 5th, 2003, 03:52 AM
from your print button, you could call a function that hides all buttons
eg:

myPrintFunction(){
d=document;
frm=d.form["myForm"];
for (z=0;z<frm.length;z++){
e=frm.elements[z];
if (e.type=="button" || e.type=="submit" || e.type=="reset")
if (d.all || d.getElementById)
e.style.visibility="hidden";
}//end loop
window.print();
};