Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# HTML页的一个div的打印错误_C#_Javascript_Html - Fatal编程技术网

C# HTML页的一个div的打印错误

C# HTML页的一个div的打印错误,c#,javascript,html,C#,Javascript,Html,我想从htmlapx页面打印一个div。我从stackoverflow那里得到了相关问题的答案 但当我点击打印链接时,什么都没有发生,有人能告诉我我做错了什么吗?我该怎么做才能使它可行呢 我的aspx页面就像 <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Report for Form Sale Money recipt</title> <

我想从htmlapx页面打印一个div。我从stackoverflow那里得到了相关问题的答案

但当我点击打印链接时,什么都没有发生,有人能告诉我我做错了什么吗?我该怎么做才能使它可行呢

我的aspx页面就像

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
 <title>Report for Form Sale Money recipt</title>
<link href="../CSS/Report/myprintstyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    printDivCSS = new String ('<link href="../CSS/Report/myprintstyle.css" rel="stylesheet" type="text/css">')
    function printDiv(ReportDiv) {
        window.frames["print_frame"].document.body.innerHTML=printDivCSS + document.getElementById(divId).innerHTML
        window.frames["print_frame"].window.focus()
        window.frames["print_frame"].window.print()
    }
</script>

</head>
<body>
<form id="form1" runat="server">
<div id ="ReportDiv">
    <b>Report Div</b> <a href='javascript:printDiv('ReportDiv')'>Print</a><br/>

    <label>Money Receipt Number</label> <asp:Label runat = "server" ID = "lblMRN"></asp:Label><br />
    <label>Reference</label> <asp:Label runat = "server" ID = "lblReference"></asp:Label><br />
    <label>Form Serial</label> <asp:Label runat = "server" ID = "lblFormSL"></asp:Label><br />
    <label>Name</label> <asp:Label runat = "server" ID = "lblName"></asp:Label><br />
    <label>Program</label> <asp:Label runat = "server" ID = "lblProgram"></asp:Label><br />
    <label>Semester</label> <asp:Label runat = "server" ID = "lblSemester"></asp:Label><br />
    <label>Paid Amount</label> <asp:Label runat = "server" ID = "lblPaidAmount"></asp:Label><br />
    <label>Comments</label> <asp:Label runat = "server" ID = "lblComments"></asp:Label><br />
    <label>Bank</label> <asp:Label runat = "server" ID = "lblBank"></asp:Label>
 </div>
 <iframe name='print_frame' width='0' height='0' frameborder='0' src='about:blank'></iframe>

</form>
</body>
</html>
单击“打印”时,我在浏览器底部发现页面错误。

尝试以下操作:

window.frames["print_frame"].focus();
window.frames["print_frame"].print();

那个错误信息是。。。到底是什么?