这可能看起来像一个简单的问题,但我用谷歌搜索了它的废话,找不到任何线索。
这是一个基本页面(为了演示目的而大幅减少)
<%@ 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中实际工作的代码进行了比较,没有真正的区别) ?我很乐意得到一个答案,“哦加上这一切,一切都会很棒!”,但我不认为这种情况发生了。所以我在问这里寻找解决方案,我完全迷失了。
答案 0 :(得分:0)
在信用到期时给予信用,请参阅有关问题的评论。我们从那里得到答案,所以我会在这里发布。
页面上抛出了几个javascript错误(在我们被引入的无关库中)。 Chrome显然没有这个问题,但IE确实如此。我更正了js错误,页面再次正常工作。活泉!