0x800a138f - Microsoft JScript运行时错误:无法获取属性的值' document&#39 ;: object is null或undefined

时间:2015-09-24 14:17:59

标签: javascript html

当我在IE 9中打印网格时,我正在获取此javascript运行时

  

错误(0x800a138f - Microsoft JScript运行时错误:无法获取属性的值' document&#39 ;: object is null或undefined)

但在其他浏览器如chrome,mozila工作正常但在IE 9中收到此错误我的代码如下所示。

从这一行获取错误......

printWindows.document.write('<html><head><title>Sales Reports</title>');

  <script type = "text/javascript">  
    function PrintPanel()     {    
  var panel = document.getElementById("<%=pnlContentss.ClientID%>");
  var printWindows = window.open('','','height=600,width=800');
  printWindows.document.write('<html><head<title>SalesReports</title>');
  printWindows.document.write('</head><body >');  
  printWindows.document.write(panel.innerHTML);   
  printWindows.document.write('</body></html>');   
  printWindows.document.close();  
  setTimeout(function () {  
  printWindow.print();  
  }, 500);
   return false;
   }
  </script>

i need to print in IE 9 please help me friends..

虽然我在IE 9中打算一个网格我得到这个javascript运行时错误(0x800a138f - Microsoft JScript运行时错误:无法获取属性的值&#39; document&#39 ;: object is null或undefined)但是在其他浏览器如chrome,mozila它的工作正常但在IE 9中得到此错误我的代码在下面给出。

 <asp:GridView ID="grdprint" runat="server" AllowPaging="false"                                      AllowSorting="True"AutoGenerateColumns="False"   Width="100%" Font-Size="12px"><RowStyle CssClass="normal" Font-Size="12px" /><HeaderStyle Font-Size="12px" />
                    <PagerStyle CssClass="pgr" />
                   <Columns>
                        <%-- <asp:TemplateField HeaderText="Product Code">
                    <ItemTemplate>
                        <asp:Label ID="lblProductCode" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ProductCode") %>'/>                           
                    </ItemTemplate>                        
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>--%>
                           <asp:TemplateField HeaderText="Product Name">                       
                    <ItemTemplate>
                        <asp:Label ID="lblProductName" runat="server"  Text='<%# DataBinder.Eval(Container.DataItem, "ProductName") %>'/>
                    </ItemTemplate>   
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField> 
                           <asp:TemplateField HeaderText="Quantity">                        
                    <ItemTemplate>
                        <asp:Label ID="lblQuantity" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity") %>' />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField> 
                    <asp:TemplateField HeaderText="Rate">
                    <ItemTemplate>
                        <asp:Label ID="lblRate" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Rate") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Amount">
                    <ItemTemplate>
                        <asp:Label ID="lblAmount" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Amount") %>' />
                    </ItemTemplate>

                </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                     </td></tr>
                     <tr>
                            <td style="padding-right:10px;float:right;">
                                 <b style="font-size:12px;">Total Amount :</b>
                                 <b >&nbsp;&nbsp;
                                    <asp:Label ID="lblptotalamt" runat="server" Font-Bold="true" Font-Size="11px"></asp:Label>
                                </b><br />
                            </td>

                     </tr>
                 <tr>
                    <td align="center">
                        <asp:Label ID="Label2" runat="server" Font-Bold="true" Font-Size="10px" ForeColor="BlueViolet"></asp:Label>
                    </td>
                 </tr>
                  <tr>
                    <td align="center">
                        <asp:Label ID="lblword" runat="server" Font-Bold="true" Font-Size="10px"></asp:Label>
                    </td>
                 </tr>
             <tr>
                    <td align="center">
                        <asp:Label ID="lblthnk" runat="server" Font-Bold="true" Font-Size="10px" Text="** Thank You * Visit Again **"></asp:Label>
                    </td>
                 </tr>
                     </table>
          <%--  </asp:Panel>--%>
        </div>
    </div>

0 个答案:

没有答案