JavaScript无法在IE11中运行

时间:2016-10-05 12:46:39

标签: javascript internet-explorer canvas

我正在尝试使用此仪表 - hook

我用这个量表创建javascript,它在chrome和Firefox中运行良好,但在IE 11中不起作用

有我的代码:

<!DOCTYPE html>


<html>
<head>
    <title>Gauges as Components</title>



<script src="http:////cdn.rawgit.com/Mikhus/canvas-gauges/gh-pages/download/latest/all/gauge.min.js"></script> 
</head>
<body>
<h1 align="center" >CPU Dashboard</h1>

<canvas id="canvas-id" >
</canvas>
<script>

var gauge = new RadialGauge({
    renderTo: 'canvas-id',
    animationRule: "linear",
    animationDuration: 1500,
    needleCircleInner: false,
    needleCircleOuter: true,
    needleCircleSize: 7,
    needleWidth: 2,
    needleType: "arrow",
    borders: false,
    borderShadowWidth: 0,
    colorPlate: "#fff",
    highlights: [
        {
            "from": 160000,
            "to": 200000,
            "color": "rgba(255,216, 0, 1)"
        },
        {
            "from": 200000,
            "to": 268000,
            "color": "rgba(255, 50, 50, .75)"
        }
    ],
    strokeTicks: true,
    minorTicks: 2,
    majorTicks: [
        "0",
        " ",
        " ",
        " ",
        " ",
        " ",
        " ",
        " ",
        " ",
        " ",
        " ",
        "268000"
    ],
    valueDec: 0,
    valueInt: 5,
    maxValue: 268000,
    minValue: 0,
    value:150000,
    units: "mhz",
    title:"CPU UTIL",
    height: 300,
    width: 300
}).draw();


</script>



</body>
</html>

我是javascript的新手。我做错了什么?

提前致谢!

2 个答案:

答案 0 :(得分:0)

我只使用本地js文件,现在可以在IE中使用。

答案 1 :(得分:0)

最近,当我的ES6代码无法在IE11上运行时,我遇到了问题。

我曾经使用过IFEEarrow functionsconst

我通过Babel recompiler转换了代码,这使我得以像在Chrome中一样正常工作。

相关问题