页面重定向问题 [英] page redirection problem
问题描述
大家好,
在我的应用程序中,当我单击预览按钮时,打印预览会弹出一个窗口.在该弹出窗口中有打印按钮,当我单击该打印按钮时,打印完成.一切都很好.
现在的问题是,当我单击打印预览"中的打印"按钮时,弹出的页面将重定向到打印预览页面.我不想重定向它.
这是我在jquery中的代码:
在此代码中,单击预览按钮时,此代码将运行:
hi all,
in my application when i click on preview button then one pop up comes with print preview. there is print button in that pop up and when i click on that print button printing is done. all the things are working fine.
Now problem is that when i click on print button in print preview pop up the page behind pop up is redirecting to print preview page. i don''t want to redirect it.
here is my code in jquery:
in this code when click on preview button this code runs:
var strVal='';
function PreviewReport(WithPrint)
{
var id;
id = document.getElementById('ctl00_ContentPlaceHolder1_lblMessage');
if (id != undefined)
{
strVal = id.innerHTML;
if(strVal == "")
{
return false;
}
else
{
if (WithPrint==1)
{
$("#PrintingDiv").load('ViewReportNew.aspx', { "strVal": strVal });
//$("#PrintingDiv").load('ViewReportNew.aspx', { "strVal": strVal }).dialog({modal:true,width:780,height:550});
}
else
{
$("#PrintingDiv").load('ViewReportNew.aspx', { "strVal": strVal }).dialog({modal:true,width:780,height:550});
}
}
}
DPrint.style.display = 'block';
return false;
}
function PrintReport()
{
//var strVal;
//strVal = document.getElementById('ctl00_ContentPlaceHolder1_lblMessage').innerHTML;
//window.open('ViewReportNew.aspx?strVal=' + strVal , '_blank', 'width=780,height=550,scrollbars=1');
//return false;
PreviewReport(0);
var prtContent = document.getElementById(strid);
var strOldOne = document.body.innerHTML;
var WinPrint = window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=1,status=1');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
document.body.innerHTML = strOldOne;
return false;
}
在预览页面上,此代码运行:
on preview page this code runs:
<script language="javascript">
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=1,status=1');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML=strOldOne;
this.close();
}
</script>
任何想法..
any idea..
推荐答案
(" ).load(' ViewReportNew.aspx',{ strVal":strVal}); //
("#PrintingDiv").load('ViewReportNew.aspx', { "strVal": strVal }); //
(#PrintingDiv").load('ViewReportNew.aspx ',{"strVal":strVal}).dialog({modal:true,width:780,height:550}); } 其他 {
("#PrintingDiv").load('ViewReportNew.aspx', { "strVal": strVal }).dialog({modal:true,width:780,height:550}); } else {
(" ).load(' ViewReportNew.aspx',{" strVal":strVal}).dialog({modal: 780 ,高度:' block'; 返回 假; } 函数PrintReport() { // var strVal; // strVal = document.getElementById('ctl00_ContentPlaceHolder1_lblMessage').innerHTML; // window.open('ViewReportNew.aspx?strVal ='+ strVal,'_ blank','width = 780, height = 550,scrollbars = 1'); // 返回false; PreviewReport( 0 ); var prtContent = document.getElementById(strid); var strOldOne = document.body.innerHTML; var WinPrint = window.open(' ',' ',' left = 0,top = 0,width = 1,height = 1,toolbar = 0,scrollbars = 1,status = 1'); WinPrint.document.write(prtContent.innerHTML); WinPrint.document.close(); WinPrint.focus(); WinPrint.print(); WinPrint.close(); document.body.innerHTML = strOldOne; 返回 假; }
("#PrintingDiv").load('ViewReportNew.aspx', { "strVal": strVal }).dialog({modal:true,width:780,height:550}); } } } DPrint.style.display = 'block'; return false; } function PrintReport() { //var strVal; //strVal = document.getElementById('ctl00_ContentPlaceHolder1_lblMessage').innerHTML; //window.open('ViewReportNew.aspx?strVal=' + strVal , '_blank', 'width=780,height=550,scrollbars=1'); //return false; PreviewReport(0); var prtContent = document.getElementById(strid); var strOldOne = document.body.innerHTML; var WinPrint = window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=1,status=1'); WinPrint.document.write(prtContent.innerHTML); WinPrint.document.close(); WinPrint.focus(); WinPrint.print(); WinPrint.close(); document.body.innerHTML = strOldOne; return false; }
在预览页面上,此代码运行:
on preview page this code runs:
<script language="javascript">
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=1,status=1');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML=strOldOne;
this.close();
}
</script>
任何想法..
any idea..
这篇关于页面重定向问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!