JavaScript IIS7 中未触发 onchange 事件
JavaScript onchange event is not firing in IIS7
源代码:
<ajaxToolkit:TabContainer ID="tbMBQOutputs" runat="server" Width="100%" Height="720px">
<ajaxToolkit:TabPanel ID="tbDashboard" runat="server" Height="100%" ToolTip="Dashboard">
<HeaderTemplate>Dashboard</HeaderTemplate>
<ContentTemplate>
<asp:UpdatePanel ID="upDashboard" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table bgcolor="#E6E6FA" align="center" border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 99%; border: solid 1px black; margin-left: 1px; margin-right: 1px;">
<tr>
<td>
<asp:Panel ID="pnlDashboard_DC" runat="server" GroupingText="Dashboard">
<table align="center" border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 99%; border: solid 1px black; margin-left: 1px; margin-right: 1px;">
<tr>
<td align="center">
<asp:Label ID="lblReportCycle_DB" runat="server" Text="Report Cycle"></asp:Label> 
<asp:DropDownList ID="ddlReportCycle_DB" runat="server" AutoPostBack="true" Width="140px" CssClass="tb2" OnSelectedIndexChanged="ddlReportCycle_DB_SelectedIndexChanged" ></asp:DropDownList>
</td>
</tr>
<tr>
<td align="center">
<asp:Label ID="lblMsgDashBoard_DB" runat="server" Font-Bold="true" ForeColor="Green"></asp:Label>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>
JavaScript:
<script type="text/javascript">
function ProgressImage_DashBoard() {
$('#<%=lblMsgDashBoard_DB.ClientID%>').html("Processing.... Please wait...!!!");
}
</script>
代码隐藏文件:
protected void Page_Load(object sender, EventArgs e)
{
ddlReportCycle_DB.Attributes.Add("onchange", "ProgressImage_DashBoard();");
}
此编码在我的系统中运行良好。但是当我在 IIS 7 中发布代码时,下拉列表更改事件根本没有触发。
但是当我在页面加载事件中注释下面的代码时,
//ddlReportCycle_DB.Attributes.Add("onchange", "ProgressImage_DashBoard();");
在 IIS 7 中,下拉列表更改事件正在运行。我需要在下拉列表更改事件期间显示标签消息。即处理。为什么此代码在 IIS 7 中不起作用?
显然这是由 JavaScript 的 IE 配置引起的。在 IIE7 中,出于某种安全原因,默认配置是 "disable JavaScript",因此您必须启用它。
我试过了,可以用..
源代码:
<asp:Label ID="lblMsgDashBoard_DB" runat="server" Font-Bold="true" ForeColor="Green"></asp:Label>
<asp:DropDownList ID="ddlReportCycle_DB" runat="server" AutoPostBack="true" Width="140px" CssClass="tb2" OnSelectedIndexChanged="ddlReportCycle_DB_SelectedIndexChanged" onchange="ShowMsg(this);"></asp:DropDownList>
JavaScript:
function ShowMsg(ddl) {
var lblMsg = document.getElementById("<%=lblMsgDashBoard_DB.ClientID %>");
$(lblMsg).html("Processing.... Please wait...!!!");
}
源代码:
<ajaxToolkit:TabContainer ID="tbMBQOutputs" runat="server" Width="100%" Height="720px">
<ajaxToolkit:TabPanel ID="tbDashboard" runat="server" Height="100%" ToolTip="Dashboard">
<HeaderTemplate>Dashboard</HeaderTemplate>
<ContentTemplate>
<asp:UpdatePanel ID="upDashboard" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table bgcolor="#E6E6FA" align="center" border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 99%; border: solid 1px black; margin-left: 1px; margin-right: 1px;">
<tr>
<td>
<asp:Panel ID="pnlDashboard_DC" runat="server" GroupingText="Dashboard">
<table align="center" border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 99%; border: solid 1px black; margin-left: 1px; margin-right: 1px;">
<tr>
<td align="center">
<asp:Label ID="lblReportCycle_DB" runat="server" Text="Report Cycle"></asp:Label> 
<asp:DropDownList ID="ddlReportCycle_DB" runat="server" AutoPostBack="true" Width="140px" CssClass="tb2" OnSelectedIndexChanged="ddlReportCycle_DB_SelectedIndexChanged" ></asp:DropDownList>
</td>
</tr>
<tr>
<td align="center">
<asp:Label ID="lblMsgDashBoard_DB" runat="server" Font-Bold="true" ForeColor="Green"></asp:Label>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>
JavaScript:
<script type="text/javascript">
function ProgressImage_DashBoard() {
$('#<%=lblMsgDashBoard_DB.ClientID%>').html("Processing.... Please wait...!!!");
}
</script>
代码隐藏文件:
protected void Page_Load(object sender, EventArgs e)
{
ddlReportCycle_DB.Attributes.Add("onchange", "ProgressImage_DashBoard();");
}
此编码在我的系统中运行良好。但是当我在 IIS 7 中发布代码时,下拉列表更改事件根本没有触发。
但是当我在页面加载事件中注释下面的代码时,
//ddlReportCycle_DB.Attributes.Add("onchange", "ProgressImage_DashBoard();");
在 IIS 7 中,下拉列表更改事件正在运行。我需要在下拉列表更改事件期间显示标签消息。即处理。为什么此代码在 IIS 7 中不起作用?
显然这是由 JavaScript 的 IE 配置引起的。在 IIE7 中,出于某种安全原因,默认配置是 "disable JavaScript",因此您必须启用它。
我试过了,可以用..
源代码:
<asp:Label ID="lblMsgDashBoard_DB" runat="server" Font-Bold="true" ForeColor="Green"></asp:Label>
<asp:DropDownList ID="ddlReportCycle_DB" runat="server" AutoPostBack="true" Width="140px" CssClass="tb2" OnSelectedIndexChanged="ddlReportCycle_DB_SelectedIndexChanged" onchange="ShowMsg(this);"></asp:DropDownList>
JavaScript:
function ShowMsg(ddl) {
var lblMsg = document.getElementById("<%=lblMsgDashBoard_DB.ClientID %>");
$(lblMsg).html("Processing.... Please wait...!!!");
}