<input onclick = "print()" type = "button" value = "print打印"> <br>
<iframe id="print" src= "02.jpg" width = "500" height = "300" style = "display:none"> </iframe>
function print()
{
document.frames( "print").document.execCommand( "Print", false);
}
--------------------------
<input onclick = "document.frames('print1').document.execCommand('print');" type = "button" value = "直接打印">
<iframe id="print1" name="print1" src="/print.jsp?xh=<%=stuBean.xh %>" width = "0" height = "0" style = "display:"> </iframe>