【发布时间】:2010-10-10 14:58:35
【问题描述】:
我在当前页面上调用了一个使用 ajax 的 iframe,并尝试打印该页面,但正在打印空白页,有人可以帮我解决这个问题
我所做的是:当前页面:
<input type="button" onclick=verifyControl('1001') >
<div id='pa_print'></div>
js文件函数:
function verifyControl(rNo) {
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Your browser does not support AJAX!");
return;
}
var url="js/p_Print.php";
url=url+"?control_no="+rNo;
xmlHttp.onreadystatechange=paymentPrintVerify;
xmlHttp.open("GET",url,true);
xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
xmlHttp.send(null);
remitCont_no=document.getElementById("remitContNo").value;
if(rNo!=remitCont_no) {
alert("invalid remit control no");
return;
}
}
function PrintVerify() {
if(xmlHttp.readyState==1) {
//document.getElementById("pa_print").innerHTML="";
//document.getElementById("pa_print").innerHTML="<div align='center'><img src='./images/loader-1.gif'/><br><label >Verifying... </label></div>";
}
if(xmlHttp.readyState==4) {
document.getElementById("pa_print").innerHTML="";
document.getElementById("pa_print").innerHTML=xmlHttp.responseText;
frames['frame1'].print();
}//end of else
}
服务器页面:p_Print.php:
<iframe src="pa_print.php?cono=<?=$contno ?>" name='frame1'></frame>
谁能帮我解决这个问题,我无法打印 iframe 的内容
【问题讨论】:
标签: php javascript html ajax