1

这似乎是一个简单的问题,但我已经用谷歌搜索了其中的废话,找不到任何线索。

这是一个基本页面(出于演示目的而大幅缩减)

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="NUBrand.master.cs" Inherits="nuservices_NUBrand" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="UTF-8" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="language" content="en" />
<script type="text/javascript">
    var isiPad = navigator.userAgent.match(/iPad/i) != null;
    var ua = navigator.userAgent;
    var isiPad = /iPad/i.test(ua);
    if (isiPad == false) { // viewport tag breaks ipad portrait... don't use it if it's an ipad
        document.write('<meta name="viewport" content="width=device-width,initial-scale=1.0">');
    }
</script>
<%--<!--[if gte IE 9]><!-->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="javascript/jquery-2.0.0.min.js"><\/script>')</script>
<!--<![endif]-->--%>

<%--js--%>
<script src="resources/js/jquery.stayInWebApp.js"></script>
<script src="resources/js/global.js"></script>

<%--css--%><link href="resources/css/bootstrap-custom.css" rel="stylesheet" />
<link href="resources/css/bootstrap-custom.css" rel="stylesheet" />
<link href="resources/forms.css" rel="stylesheet" />
<link href="resources/css/normalize.css" rel="stylesheet" />
<link href="resources/css/global.css" rel="stylesheet" />
<link media="all and (max-width: 768px)" rel="stylesheet" type="text/css" href="resources/css/mobile.css" />

<script src="resources/js/modernizr.js"></script>
<asp:ContentPlaceHolder ID="cphHead" runat="server" />
</head>
<body>
<div id="container">
    <header id="mainHead">
    </header>
    <div id="pageHeader">
        <div id="breadcrumb">
            <asp:ContentPlaceHolder ID="cphHeaderLinks" runat="server" />
        </div>
        <div class="container-fluid">
            <form id="Form1" runat="server" name="form1">
                <asp:ContentPlaceHolder ID="cphBodyWithForm" runat="server" />
                <asp:ContentPlaceHolder ID="cphBody" runat="server" />
                <asp:ContentPlaceHolder ID="cphInputForm" runat="server" />
            </form>
            <div id="pageChildren">
            </div>
        </div>
    </div>

    <footer id="mainFooter">
    </footer>
</div>
<asp:ContentPlaceHolder ID="cphPageScripts" runat="server" />
</body>
</html>

如果内容不重要,请告诉我,为了读者,我也可以将其删除。

在正文的主要部分,我有三个内容占位符

<asp:ContentPlaceHolder ID="cphBodyWithForm" runat="server" />
<asp:ContentPlaceHolder ID="cphBody" runat="server" />
<asp:ContentPlaceHolder ID="cphInputForm" runat="server" />

如果这很重要,我在我的大部分页面中都使用 cphBody,其他页面是出于遗留原因。

一个不能在 IE9 中运行(但在 Chrome 中运行良好)的示例页面如下所示:

<asp:Content ContentPlaceHolderID="cphBody" runat="Server">
    <div class="row-fluid span12">
        <div class="span7">
            <%--validation summary--%>
            <div class="row-fluid">
                <div class="span12">
                    <asp:ValidationSummary ID="ValidationSummary2" runat="server" HeaderText="You must provide:"
                        ForeColor="#BF2E1A" />
                </div>
            </div>
            <%--career week date--%>
            <div class="row-fluid">
                <div class="span6">
                    <span>Career Week Date:<%= UtilsWww.RequiredAsterisk %></span>
                </div>
                <div class="span6">
                    <asp:DropDownList runat="server" ID="inDate">
                        <asp:ListItem Text="" />
                        <asp:ListItem Text="February" />
                        <asp:ListItem Text="May" />
                        <asp:ListItem Text="August" />
                        <asp:ListItem Text="November" />
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator runat="server" ErrorMessage="Career Week date" ID="RequiredFieldValidator4"
                        ControlToValidate="inDate" Display="Dynamic" Text="X" EnableClientScript="True" />
                </div>
            </div>
            <%--Contact Email--%>
            <div class="row-fluid">
                <div class="span6">
                    <span>Contact's email:<%= UtilsWww.RequiredAsterisk %></span>
                </div>
                <div class="span6">
                    <asp:TextBox runat="server" ID="txtContactPersonEmail"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ErrorMessage="Contact Person's Email"
                        ID="RequiredFieldValidator3" Display="Dynamic" ControlToValidate="txtContactPersonEmail"
                        ToolTip="A contact person email must be provided!">X</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator runat="server" ErrorMessage="Valid Email Address"
                        ID="RegularExpressionValidator1" Display="Dynamic" ControlToValidate="txtContactPersonEmail"
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ToolTip="Email addresses must conform to internet email standards!">X</asp:RegularExpressionValidator>
                </div>
            </div>
            <div class="row-fluid">
                <asp:LinkButton ID="Linkbutton1" runat="server" CssClass="formSubmitButton" OnClick="Linkbutton1_Click">
                        Submit<img src="resources/images/icn_getstarted.png" alt="submit" class="btn-arrow"/>
                </asp:LinkButton>
            </div>
        </div>
        </div>
        <div class="span5">
    </div>
</asp:Content>

此示例页面的代码隐藏执行以下操作:

protected void Linkbutton1_Click(object sender, EventArgs e)
{
    this.Validate();

    if (!this.IsValid) return;
    ...Do some other Stuff...
}

这是我所有问题发生的地方:

if (!this.IsValid) return;

在 Chrome 中,该语句不会返回,一切都是有效的,它就是这样做的。

在 IE9 中,该行命中了 return 语句,我感到悲伤和困惑。

那么你认为这里发生了什么?我在哪里可以看(我试过 fiddler,在 IE 开发工具中调试 js,它变得令人困惑,我将他们在“破碎页面”中的代码与在 IE9 中实际工作的少数代码进行了比较,没有真正的区别) ? 我很想得到像“哦,加上这个,一切都会很棒!”这样的答案,但我不认为会发生这种情况。所以我问在哪里寻找解决方案,我完全迷失了。

4

1 回答 1

0

要在信用到期时给予信用,请参阅有关问题的评论。我们从那里得到了答案,所以我会在这里发布。

页面上抛出了几个 javascript 错误(在我们被拉入的不相关库中)。Chrome 显然没有这个问题,但 IE 有。我更正了 js 错误,页面再次正常工作。哇!

于 2013-06-05T16:41:56.063 回答