首页 > 开发 > PHP > 正文

用在PHP里的JS打印函数

2024-05-04 22:57:34
字体:
来源:转载
供稿:网友
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";
}
}

,欢迎访问网页设计爱好者web开发。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表