Javascript代码无法在IE中运行,但可以正常使用Firefox和Chrome

时间:2014-03-31 10:44:43

标签: javascript internet-explorer firefox

我用javascript编写的代码在Firefox和Chrome中工作正常,但在执行相同代码时,IE页面会重新加载 下面是我简单的javascript代码

此代码在Firefox和Chrome中运行良好但在IE页面执行时重新加载是错误的

    <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();


    }

0 个答案:

没有答案