为什么我的脚本不会在Microsoft Edge(IE)中运行?

时间:2018-03-30 04:33:34

标签: internet-explorer cross-browser compatibility

我有以下脚本,我一直在使用Chrome进行编辑。然而,我只是意识到它在IE浏览器中不起作用。我在这里阅读了之前的帖子,似乎与在函数中添加return false;有关。我试过了,但它似乎没有帮助。

任何进一步的建议将不胜感激。

<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="scripts/variablegeneration.js"></script>


<script type='text/javascript'>
$(document).ready(function () {
$('.fraction').each(function(key, value) {
    $this = $(this)
    var split = $this.html().split("|")
    if( split.length == 2 ){
        $this.html('<span class="top">'+split[0]+'</span><span class="bottom">'+split[1]+'</span>')
 //////////I'VE TRIED ADDING VARIOUS ITERATIONS OF CODE HERE
    }    
});
});

</script>

<script type='text/javascript'>
$(document).ready(function () {
function randomBetween (min, max) {
  var ceiling = max + 1;
  return Math.floor(Math.random() * (ceiling - min)) + min;
//////////I'VE TRIED ADDING VARIOUS ITERATIONS OF CODE HERE
}

function randomBetweenAndExcluding (min, max, array) {
  var random;
  do {
    random = randomBetween(min, max);
  } while(array.includes(random));
  return random;
//////////I'VE TRIED ADDING VARIOUS ITERATIONS OF CODE HERE
}

array = [1,2,5];
var random1High = randomBetween(2, 10);
 $('.random1High').html(random1High );

});
</script>

</head>

<body>

    TEST  <span class = "GenerateRandomNumber2to6No1"></span> Less than 1:  <span class = "GenerateRandomNumber2to6lessthanNo1"></span> Others:   <span class = "GenerateRandomNumber2to6No2"></span> / <span class = "GenerateRandomNumber2to6No3"></span>  / <span class = "GenerateRandomNumber2to6No4"></span> / <span class = "GenerateRandomNumber2to6No5"></span> 
</body>

0 个答案:

没有答案