我的web资源javascript代码运行在chrome上,但不在dynamics crm的IE 11中

我的web资源javascript代码运行在chrome上,但不在dynamics crm的IE 11中,javascript,dynamics-crm,Javascript,Dynamics Crm,我的加载事件java脚本代码在chrome中成功运行,在IE 11中不起作用。不知道为什么会发生这种情况。请帮助我,我搜索了很多,但没有找到正确的解决方案。我正在为dynamics crm 2011编写java脚本,但无法完成任务。任何更改都不会显示在IE 11中,而是显示在chrome中。我正在下面添加代码 function calculateManHour() { debugger; var advantageManHourCost = 0; var engageM

我的加载事件java脚本代码在chrome中成功运行,在IE 11中不起作用。不知道为什么会发生这种情况。请帮助我,我搜索了很多,但没有找到正确的解决方案。我正在为dynamics crm 2011编写java脚本,但无法完成任务。任何更改都不会显示在IE 11中,而是显示在chrome中。我正在下面添加代码

 function calculateManHour() {
    debugger;
    var advantageManHourCost = 0;
    var engageManHourCost = 0;
    var advantageManDayCost = 0;//new
    var engageManDayCost = 0;//new
    var advantageManHour = 0;
    var engageManHour = 0;
    var advantageManDay = 0;//new
    var engageManDay = 0;//new
    var currentQuoteProductId = Xrm.Page.data.entity.getId().toString().split("{")[1].split("}")[0];
    var costPricePerUnit = parseFloat(Xrm.Page.getAttribute("costprice").getValue());
    var serviceProvider = Xrm.Page.getAttribute("serviceprovider").getValue()[0].name;
    var quoteProductType = Xrm.Page.getAttribute("quoteproducttype").getValue();
    var quoteProductElem = Xrm.Page.getAttribute("quoteproducttype");
    var config = getRecord("manhourcostconfigSet", "2A7F8D4D-10C4-E911-943A-00155D1E13EA");
    var currentQuoteProduct = getRecord("QuoteDetailSet", currentQuoteProductId);
    advantageManHourCost = parseFloat(config.ManHourCost.Value);
    engageManHourCost = parseFloat(config.EngageManhourcost.Value);
    advantageManDayCost = parseFloat(config.AdvantageMandaycost.Value);//new
    engageManDayCost = parseFloat(config.EngageMandaycost.Value);//new
    if (quoteProductType == false) {
        Xrm.Page.getAttribute("valueoffering").setValue(true);
        if (serviceProvider == "Services_ADVANTAGE") {
            advantageManHour = costPricePerUnit / advantageManHourCost;
            advantageManDay = costPricePerUnit / advantageManDayCost;
            engageManHour = null;
            engageManDay = null;
            Xrm.Page.getControl("engagebudgetedmanhours").setVisible(false);
            Xrm.Page.getControl("engagemandaycost").setVisible(false);
            setTooltip("advantagemandaycost", advantageManDayCost, "advantagebudgetedmanhours", advantageManHourCost);
        }
        if (serviceProvider == "Services_ENGAGE") {
            engageManHour = costPricePerUnit / engageManHourCost;
            engageManDay = costPricePerUnit / engageManDayCost;
            advantageManHour = null;
            advantageManDay = null;
            Xrm.Page.getControl("advantagebudgetedmanhours").setVisible(false);
            Xrm.Page.getControl("advantagemandaycost").setVisible(false);
            setTooltip("engagemandaycost", engageManDayCost, "engagebudgetedmanhours", engageManHourCost);
        }
        var data = {
            "engagebudgetedmanhours": engageManHour,
            "advantagebudgetedmanhours": advantageManHour, 
            "engagemandaycost": engageManDay,
            "advantagemandaycost": advantageManDay
        }
        Xrm.Page.getAttribute("advantagebudgetedmanhours").setValue(advantageManHour);
        Xrm.Page.getAttribute("engagebudgetedmanhours").setValue(engageManHour);
        Xrm.Page.getAttribute("advantagemandaycost").setValue(advantageManDay);//new
        Xrm.Page.getAttribute("engagemandaycost").setValue(engageManDay);//new
        Xrm.Page.getAttribute("engagebudgetedmanhours").setSubmitMode("always");
        Xrm.Page.getAttribute("advantagebudgetedmanhours").setSubmitMode("always")
        Xrm.Page.getAttribute("engagemandaycost").setSubmitMode("always");//new
        Xrm.Page.getAttribute("advantagemandaycost").setSubmitMode("always")//new
        Xrm.Page.data.entity.save();

    }
}

function setTooltip(attribute1, tip1, attribute2, tip2) {
    debugger;
    try {
        if (!attribute1 || !tip1 && !attribute2 || !tip2) {
            return;
        }

        var control1 = Xrm.Page.getControl(attribute1);
        var control2 = Xrm.Page.getControl(attribute2);

        if (!control1 || !control2) {
            return;
        }

        var element1 = document.getElementById(attribute1 + "_d");
        var element2 = document.getElementById(attribute2 + "_d");


        if (!element1 || !element2) {
            return;
        }

        var tooltipSpan1 = document.createElement("span");

        tooltipSpan1.id = attribute1 + "_tooltip";
        tooltipSpan1.textContent = "Man Day Cost is = " + tip1;
        tooltipSpan1.setAttribute(
            "style",
            "display: none; width: 120px; background-color:  #fdfafa; color: ; rgb(23, 22, 22): center; padding: 5px 5px; border-radius: 3px;" +
            "border: 1px solid black;z-index: 1;"
        );

        var tooltipSpan2 = document.createElement("span");

        tooltipSpan2.id = attribute1 + "_tooltip";
        tooltipSpan2.textContent = "Man Hour Cost is = " + tip2;
        tooltipSpan2.setAttribute(
            "style",
            "display: none; width: 120px; background-color:  #fdfafa; color: ; rgb(23, 22, 22): center; padding: 5px 5px; border-radius: 3px;" +
            "border: 1px solid black;z-index: 1;"
        );

        element1.appendChild(tooltipSpan1);
        element2.appendChild(tooltipSpan2);

        document.getElementById(attribute1 + "_c").setAttribute("title", "Man Day Cost is = " + tip1);
        document.getElementById(attribute2 + "_c").setAttribute("title", "Man Hour Cost is = " + tip2);

        element1.addEventListener("mouseover", (e) => {
            tooltipSpan1.style.display = "inline";
            tooltipSpan1.style.top = (e.clientX + 20) + 'px';
            tooltipSpan1.style.left = (e.clientY + 20) + 'px';
        });
        element1.addEventListener("mouseout", (e) => {
            tooltipSpan1.style.display = "none";
        });

        element2.addEventListener("mouseover", (e) => {
            tooltipSpan2.style.display = "inline";
            tooltipSpan2.style.top = (e.clientX + 20) + 'px';
            tooltipSpan2.style.left = (e.clientY + 20) + 'px';
        });
        element2.addEventListener("mouseout", (e) => {
            tooltipSpan2.style.display = "none";
        });



    } catch (e) {
        console.log(e);
    }
}

您正在使用arrow=>函数。IE11不支持它们。箭头功能属于ES6,IE11尚不支持该功能

有很多在线工具可以帮助您将ES6转换为Es5

转换下面的函数

element1.addEventListener("mouseover", (e) => {
        tooltipSpan1.style.display = "inline";
        tooltipSpan1.style.top = (e.clientX + 20) + 'px';
        tooltipSpan1.style.left = (e.clientY + 20) + 'px';
    });
到下面这样的地方

element1.addEventListener("mouseover", function(e) {
        tooltipSpan1.style.display = "inline";
        tooltipSpan1.style.top = (e.clientX + 20) + 'px';
        tooltipSpan1.style.left = (e.clientY + 20) + 'px';
    });

你能提供一些代码吗?哪些代码有效,哪些代码无效。非常抱歉,我已经在上面添加了我的代码。请检查。