mlse
03-06-2005, 01:44 PM
Hi.
I am am javascript virgin. I would like to send part of a webpage to the printer when the user clicks on a "print" button.
I have tried stuff like this:
<layer name='print_me'>
This text is the only thing I want to print.
</layer name>
<input type='button' onclick='document.layers["print_me"].print()' value='Print'>
The trouble is, it doesn't matter what I put in the "onclick" tag for the input, I just can't get the stuff in the layer to print!! :mad: The best I have been able to do so far is 'window.print()', which prints the entire contents of the window. Which is not what I want. I am sure that what I do want to do is actually frustratingly simple, but I just don't know the syntax!
On the same (well, a similar) note, is there a top-level object in Javascript (much like the t-variable in LISP) which contains a recursive print method, allowing it and all it's children to be written to standard out (effectively tracing the entire language, showing functional and member variable inheritance).
Any help would be much appreciated!
TIA,
Mike.
I am am javascript virgin. I would like to send part of a webpage to the printer when the user clicks on a "print" button.
I have tried stuff like this:
<layer name='print_me'>
This text is the only thing I want to print.
</layer name>
<input type='button' onclick='document.layers["print_me"].print()' value='Print'>
The trouble is, it doesn't matter what I put in the "onclick" tag for the input, I just can't get the stuff in the layer to print!! :mad: The best I have been able to do so far is 'window.print()', which prints the entire contents of the window. Which is not what I want. I am sure that what I do want to do is actually frustratingly simple, but I just don't know the syntax!
On the same (well, a similar) note, is there a top-level object in Javascript (much like the t-variable in LISP) which contains a recursive print method, allowing it and all it's children to be written to standard out (effectively tracing the entire language, showing functional and member variable inheritance).
Any help would be much appreciated!
TIA,
Mike.