java Script

how to print contents of specific div at html?

function printdiv(id)
{

try{
var x = ”;
x = document.getElementById(id).innerHTML;
//alert(x);
newwindow2=window.open(”,’name’,’scrollbars=yes,resizable=yes,height=500,width=500,toolbar=1′);
newwindow2.title = “The new title goes here.”;
var tmp = newwindow2.document;
tmp.write(x);
newwindow2.print();
tmp.close();
newwindow2.close();
}catch(err){}

}

Advertisements