function printfile(id){

var myWindow=window.open("filename.php?id="+id);

myWindow.print();

myWindow.focus();

myWindow.document.close();

}

Use function on onclick event

Advertisements