• 4103阅读
  • 0回复

【转载】 用在PHP里的JS打印函数 [复制链接]

上一主题 下一主题
离线XChinux
 

只看楼主 倒序阅读 楼主  发表于: 2005-07-30
出处:奥索网
责任编辑:zwg

  auto=1立即PRINT,否则timeOut毫秒后PRINT,如printPage(0,5000);


function printPage($auto=1,$timeOut=10000) {
if ($auto == 1) {
echo "
< SCRIPT LANGUAGE="JavaScript" >
< !-- Begin
if (window.print) {
window.print();
}
else {
alert('No printer driver in your PC');
}
// End -- >
< /script >
n";
}
else {
echo "
< SCRIPT LANGUAGE="JavaScript" >

< !-- Begin
if (window.print) {
setTimeout('printCheck()','$timeOut');
}
else {
alert('No printer driver in your PC');
}
function printCheck() {
agree = confirm('OK to print now?');
if (agree) window.print();
}
// End -- >
< /script >
n";
}
}
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
快速回复
限100 字节
 
上一个 下一个