三秦IT网在线论坛's Archiver

蓝冰 发表于 2007-5-16 10:20

用在PHP里的JS打印函数

auto=1立即PRINT,否则timeOut毫秒后PRINT,如printPage(0,5000); <BR><BR><BR>function printPage($auto=1,$timeOut=10000) { <BR>if ($auto == 1) { <BR>echo " <BR>&lt; SCRIPT LANGUAGE="JavaScript" &gt; <BR>&lt; !-- Begin <BR>if (window.print) { <BR>window.print(); <BR>} <BR>else { <BR>alert(@#No printer driver in your PC@#); <BR>} <BR>// End -- &gt; <BR>&lt; /script &gt; <BR>n"; <BR>} <BR>else { <BR>echo " <BR>&lt; SCRIPT LANGUAGE="JavaScript" &gt; <BR><BR>&lt; !-- 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 -- &gt; <BR>&lt; /script &gt; <BR>n"; <BR>} <BR>}

页: [1]



Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.