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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to print the contents of text box?

Status
Not open for further replies.

alan123

MIS
Oct 17, 2002
149
0
0
US
Hi,

There is "window.print();" to print whole page, now I have form textarea box on this page and want only print the contents of this textarea box(it has scroll bar on the right side), how can I do that? can I use javascript or something else to print it? thanks in advance.
 
The easiest way is probably to write the contents to a popup.
Code:
function printTextArea(){
  var popPrint=window.open();
  popPrint.document.open("text/plain");
  popPrint.document.write(document.formName.textAreaName.value)
  popPrint.print();
  popPrint.close();
}

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top