Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a textarea

Status
Not open for further replies.

awingnut

Programmer
Feb 24, 2003
759
US
I have a preformatted textarea that my user can edit. Once done I want the user to be able to print the content of the textarea. I set up a javascript to do that but it prints the entire page rather then just the textarea. How do I print just that part? TIA.
Code:
function startPrint(theForm) {
   print(theForm.mytextarea.value);
}
 
Others may have a simpler answer, I have not worked with print commands from Javascript but a possible solution would be to grab the value and pop open a new window with that value for printing.
Or possibly create a new layer with that info and print that layer.


It's hard to think outside the box when I'm trapped in a cubicle.
 
Thanks for the reply. I take it this is not simple. Suppose the user has popups turned off? Is it still possible?
 
Again, I do not know much about printing from javascript. It might not be difficult but I do not know.

I am unsure if printing from a layer will print just that one layer or the entire page, I suspect just the current layer would print, especially of that layer was the full size of the window. It's worth a try.

For a popup, you can always test if the window opened or not and if not then store the data in a hidden form field and submit the page to another printing page. Not ideal but work-arounds happen when you have to deal with what-ifs.

It's hard to think outside the box when I'm trapped in a cubicle.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top