Javascript代码在IE中不起作用,但在Firefox和chrome中效果很好
我已经用javascript编写了代码,它在Firefox和chrome中运行良好,但在IE中,当执行相同的代码时,页面会重新加载 下面是我的简单javascript代码 这段代码在Firefox和chrome中运行良好,但在IE页面中执行时是重载,这是错误的Javascript代码在IE中不起作用,但在Firefox和chrome中效果很好,javascript,internet-explorer,firefox,Javascript,Internet Explorer,Firefox,我已经用javascript编写了代码,它在Firefox和chrome中运行良好,但在IE中,当执行相同的代码时,页面会重新加载 下面是我的简单javascript代码 这段代码在Firefox和chrome中运行良好,但在IE页面中执行时是重载,这是错误的 <asp:Button ID="btnCancelExpensenew" runat="server" Text="Cancel" OnClientClick="javascript:OnCancelExpens
<asp:Button ID="btnCancelExpensenew" runat="server" Text="Cancel"
OnClientClick="javascript:OnCancelExpensePopup();" CausesValidation="false" />
function OnCancelExpensePopup() {
$("#dialog-modal").dialog('close');
ExpenseType = "";
expenseId_expenseGroupId = "";
expenseDetailId = 0;
var city1 = $('#<%=ddlCity.ClientID %>');
var city2 = $('#<%=ddlFromCity.ClientID %>');
var city3 = $('#<%=ddlToCity.ClientID %>');
var client = $('#<%=ddlClientList.ClientID %>');
$(city1).empty();
$(city2).empty();
$(city3).empty();
$(client).empty();
$('#expenseSave').prop('disabled', false);
var chkSupportAttachedNew = $('#chkSupportAttachedNew');
chkSupportAttachedNew.prop('checked', false);
var chkIsAllowZeroNew = $('#chkIsAllowZeroNew');
var chkIsAllowZeroNewlabel = $('#chkIsAllowZeroNewlabel');
chkIsAllowZeroNew.prop('checked', false);
chkIsAllowZeroNew.hide();
chkIsAllowZeroNewlabel.hide();
var chkStayWithRelativesNew = $('#chkStayWithRelativesNew');
var chkStayWithRelativesNewlabel = $('#chkStayWithRelativesNewlabel');
chkStayWithRelativesNew.prop('checked', false);
$('#txtBillNumberNew').prop('disabled', false);
$('#txtClaimAmountNew').prop('disabled', false);
$('#txtBillAmountNew').prop('disabled', false);
$('#<%=ddlCity.ClientID %>').prop('disabled', false);
$('#<%=ddlState.ClientID %>').prop('disabled', false);
$('#errormessage3').css("display", "none");
chkStayWithRelativesNew.hide();
chkStayWithRelativesNewlabel.hide();
$('#txtBillNumberNew').val("");
//$('#txtBillDateNew').val("");
$('#txtBillAmountNew').val("");
$('#txtClaimAmountNew').val("");
$('#txtDetailFromDateNew').val("");
$('#txtDetailToDateNew').val("");
$('#<%=txtKiloMeterVistedNew.ClientID%>').val("");
$('#<%=lblRatePerKMNew.ClientID%>').val("");
$('#<%=txtRemarksNew.ClientID%>').val("");
$('#tableClientList').empty();
}
通常,ASP.net脚本在IE中以不同于其他非Microsoft浏览器的方式绑定到其回调。你应该检查一下,它是否在IE中进行回拨。您可能必须对JS代码进行故障排除,以确定您的代码的哪一部分正在强制页面刷新。请提供更多细节,也许我能帮上忙。谢谢回复,得到了部分解决方案。调用javascript函数的按钮是服务器控件,在将服务器控件替换为html后,它可以正常工作,但当服务器返回一些在Fire Fox和chrome中正常工作的消息时,页面仍在IE中重新加载。我在标签中显示来自页面上代码的消息。请帮助