当前位置:开发者网络 >> 技术教程 >> PHP教程 >> PHP函数 >> 内容
精彩推荐
分类最新教程
分类热点教程
  
用在PHP里的JS打印函数
作者:未知
日期:2004-09-23
人气:
投稿:snow(转贴)
来源:未知
字体:
收藏:加入浏览器收藏
以下正文:
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";
}
}

相关文章: