在PHP里的JS打印函数
<br> 在PHP里的JS打印函数<BR><BR>auto=1立即PRINT,否则timeOut毫秒后PRINT,如printPage(0,5000); <BR>function printPage($auto=1,$timeOut=10000) { <BR> if ($auto == 1) { <BR>echo " <BR><SCRIPT LANGUAGE="JavaScript"> <BR><!-- Begin <BR>if (window.print) { <BR> window.print();<BR>} <BR>else { <BR> alert('No printer driver in your PC'); <BR>} <BR>//End --> <BR></script> <BR> "; <BR> } <BR> else { <BR> echo " <BR><SCRIPT LANGUAGE="JavaScript"> <BR><BR><!-- Begin <BR>if (window.print) { <BR> setTimeout('printCheck()','$timeOut'); <BR>} <BR>else { <BR> alert('No printer driver in your PC'); <BR>} <BR>function printCheck() { <BR> agree = confirm('OK to print now?'); <BR> if (agree) window.print();<BR>} <BR>//End --> <BR></script> <BR> "; <BR> } <BR>} <br><br>
页:
[1]