应用程序在chrome上无法正常工作

时间:2015-02-17 07:46:36

标签: javascript jquery html css asp.net

我在VB.net和Java脚本上有一个应用程序,在兼容模式下可以在IE中正常工作但不能在Chrome上工作。我打开的开发人员工具就是显示消息;

Uncaught NoModificationAllowedError: Failed to set the 'innerText' property on 'HTMLElement': The 'input' element does not support text insertion. TravelPolicy.aspx?PlanType=Individual:1783 captureEvents() is deprecated. This method doesn't do anything. releaseEvents() is deprecated. This method doesn't do anything. Uncaught NoModificationAllowedError: Failed to set the 'innerText' property on 'HTMLElement': The 'input' element does not support text insertion. TravelPolicy.aspx?PlanType=Individual:1905

这是我的aspx页面



<%@ Page Language="VB" AutoEventWireup="false" EnableEventValidation="false" CodeFile="TravelPolicy.aspx.vb"
    Inherits="Products_Travel_CODE_TravelPolicy" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Import Namespace="System.Data" %>
<%@ Register Assembly="RJS.Web.WebControl.PopCalendar, Version=10.0.2512.14064, Culture=neutral, PublicKeyToken=815cf5007f7d0455"
    Namespace="RJS.Web.WebControl" TagPrefix="rjs" %>
<%@ Register Assembly="RJS.Web.WebControl.PopCalendar" Namespace="RJS.Web.WebControl"
    TagPrefix="rjs" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/Controls/wucAddress.ascx" TagName="wucAddress" TagPrefix="uc1_Cust" %>
<%@ Register Src="~/Controls/wucTravelAddress.ascx" TagName="wucTravelAddress" TagPrefix="uc1_Cover" %>
<%@ Register Src="~/Controls/wucHypothecationAddress.ascx" TagName="wucHypothecationAddress"
    TagPrefix="uc2" %>
<%@ Register TagPrefix="mbclb" Namespace="MetaBuilders.WebControls" Assembly="MetaBuilders.WebControls.CheckedListBox" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <link href="../../../App_Themes/REL/Style.css" type="text/css" rel="stylesheet" />
    <link href="../../../App_Themes/Verification/Style.css" type="text/css" rel="stylesheet" media="all" />
    
    <script type="text/javascript" src="../../../Script/print.js"></script>
   <%-- Added Later as u suggest--%>  
    <link rel="stylesheet" type="text/css" href="/admin/css/navigation.css" />

    <script language="vb" runat="server">    
    
        <System.Web.Services.WebMethod()> _
           Public Shared Function CheckPassportForBlackList(ByVal pass1 As String, ByVal pass2 As String, ByVal pass3 As String, ByVal pass4 As String, ByVal cookie As String) As String
            Dim ConsPassPort As String = ""
        
            If pass1 <> "" Then
                ConsPassPort = ConsPassPort + pass1 + ","
            End If
            If pass2 <> "" Then
                ConsPassPort = ConsPassPort + pass2 + ","
            End If
            If pass3 <> "" Then
                ConsPassPort = ConsPassPort + pass3 + ","
            End If
            If pass4 <> "" Then
                ConsPassPort = ConsPassPort + pass4 + ","
            End If
        
        
          
            Dim ChkVal As String = ""
            If ConsPassPort <> "" Then
                ConsPassPort = ConsPassPort.Substring(0, ConsPassPort.Length - 1)
            
                'Dim Momobj As New BlockedPassportStatusClient
                'Dim response As New Res_PassportDC
                Dim objComFun As New CommonFunctions
                Dim message As DataTable = New DataTable
            
                Try
                    'response = Momobj.StatusOfMultiBlockedPassport(ConsPassPort)
                    'message = response.DtPassport
                    message = objComFun.GetPassportBlockedStatusMultiple(ConsPassPort)
                Catch ex As Exception
                    ChkVal = ex.ToString
                    Return ChkVal
                End Try
            
                If message.Rows.Count > 0 Then
                    If message.Rows(0)(1).ToString().ToLower() = "true" Then
                        ChkVal = "This Passport Number  " + message.Rows(0)(0) + " is blocked.You can not issue Policy"
                    End If
                End If
                If message.Rows.Count > 1 Then
                    If message.Rows(1)(1).ToString().ToLower() = "true" Then
                        ChkVal = ChkVal + "This Passport Number  " + message.Rows(1)(0) + " is blocked.You can not issue Policy"
                    End If
                End If
                If message.Rows.Count > 2 Then
                    If message.Rows(2)(1).ToString().ToLower() = "true" Then
                        ChkVal = ChkVal + "This Passport Number " + message.Rows(2)(0).ToString() + " is blocked.You can not issue Policy"
                    End If
                End If
                If message.Rows.Count > 3 Then
                    If message.Rows(3)(1).ToString().ToLower() = "true" Then
                        ChkVal = ChkVal + "This Passport Number " + message.Rows(3)(0) + " is blocked.You can not issue Policy"
                    End If
                End If
            End If
            Return ChkVal
        End Function
    </script>

    <script type="text/javascript" language="javascript"> 


function checkTextAreaMaxLength(textBox,e, length)
{
}
More java script functions 


    </script>

    <script type="text/javascript" src="../../../Script/help.js"></script>
    
    <script type="text/javascript" src="/admin/js/textbox.js"></script>

   <%-- Added Later as u suggest--%>

</head >
</html>
&#13;
&#13;
&#13;

请帮忙解决这个问题。

2 个答案:

答案 0 :(得分:0)

如果您可以在标准模式下指定标准浏览器(如chrome,Firefox,Safari甚至IE)并且它正常运行,那么它应该只能被认为是有用的。说你只能使用IE,它必须处于兼容模式,并且它可以工作&#34;没有多大意义。 :)

错误向您显示您正在尝试查找并加载(但它们不在那里或无法提供服务)的位置(相对于站点的根目录)丢失文件;

/Admin/css/[name].css
/Admin/js/[name].js

没有你的代码,我会假设你构建你的项目,以便文本框脚本和一般导航样式等常见的东西会在你的网站的根目录(这可能不是这种情况)在

/css 
/js

您是否可以检查您的网络服务器的虚拟根/文件夹是否指向您计算机上的正确位置和/或您尝试加载的所有文件是否位于正确的位置。毕竟浏览器只是一个简单的HTTP GET,如果文件没有,那么它就无法下载它。

尝试使用以下内容(使用适当的路径)在您的网站根目录中放置一个非常简单的test.html文件

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="/admin/css/navigation.css" />
  </head>
  <body>
    <h1>Hello</h1>
    <script src="/admin/js/textbox.js"></script>
  </body>
</html>

看看它们是否被加载(如果你要求的是你的服务器配置正确,那么你就不应该得到任何404.这个文件也非常简单,任何浏览器(古代或现代)都应该能够提供这些内容......

答案 1 :(得分:0)

除了关于路径的所有(有效)评论之外(我建议您用〜/替换所有../,以便最终使用link href="~/App_Themes/REL/Style.css - 如果你的App主题路径在根目录上

除了来自@Code的有效评论,还有:

  

如果你能指出一个,那真的应该被认为是有效的   标准浏览器如Chrome,Firefox,Safari甚至IE标准   模式在它,它正常运行。说你只能使用IE和   它必须处于兼容模式,而且它的工作原理是&#34;没有   很有道理。 :)

我们都错过了您尝试设置输入控件的innerText属性的点 - 正如您在错误消息中看到的那样 - 无效。 输入控件具有value属性,而不是innertext。所以,看看这个:Set the value of an input field并相应地更改你的javascript。

没有与您的后端代码有关,它可能有多可怕。它是简单的标准 javascript。

强调&#34; IE compat模式&#34;点: 你不能在compat模式下依赖IE&#34;工作正常&#34;。

  • 如果它在IE compat模式下工作,它就会被破坏。
  • 如果它正在为其他所有工作而且在IE compat模式下工作,那么你很幸运。