codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mariastella</title>
<script language="javascript" type="text/javascript">
function stampa(){
document.getElementById("mybox").innerHTML=document.getElementById("myid").value;
window.print();
}
</script>
<style type="text/css">
#mybox{
display:none; /*Nasconde il div mybox*/
}
</style>
<style type="text/css" media="print">
body *{
display:none; /*nasconde, alla stampa, tutta la pagina*/
}
body #mybox{
display:block !important;
}
</style>
</head>
<body>
<div id="mybox"></div>
<h1>Stampa contenuto textarea</h1>
<textarea rows="4" cols="80" id="myid">Mariastella mariastella mariastella mariastella mariastella mariastella mariastella</textarea>
<input type="button" value="Stampa" onclick="stampa()" />
</body>
</html>
Fammi sapere se ti gira