脚本在除IE之外的所有其他浏览器中都能完美运行

Script runs perfectly in all other browsers but IE

本文关键字:浏览器 其他 运行 完美 IE 脚本      更新时间:2023-09-26

这段代码块在所有其他浏览器中都能很好地工作。当我对页面进行硬刷新时,它确实在 IE 中有效,但在此后再次转到页面时则不行。我不知道为什么。任何煽动都会有很大帮助。

function pageLoad(sender, args) {
/// func auto-sets the yellow and red values for mean and median respectfully
function calculateGoals(goal, yellow, red) {
    $(document.body).on('input', goal, function () {
        var g = $(goal), y = $(yellow), r = $(red); //set up the selectors
        y.val(parseFloat(g.val()) + 0.001);
        r.val(parseFloat(g.val()) + parseFloat(g.val()) * 0.2);
        y.attr('value', parseFloat(g.val()) + 0.0001);
        r.attr('value', parseFloat(g.val()) + parseFloat(g.val()) * 0.2);
    });
}
/// call the funcs for mean and median
calculateGoals('.mean-goal', '.mean-yellow', '.mean-red');
calculateGoals('.median-goal', '.median-yellow', '.median-red');
}

该脚本从".mean-goal"获取输入,并根据用户输入相应地更改其他值。

JS Fiddle:http://jsfiddle.net/Jn52h/- 即使在IE中,它似乎也可以正常工作。但是在我的开发环境中,重新加载页面后(软刷新后)它不起作用。

通了。如果有人遇到此问题,只需将此类问题的"input"func 类型更改为"keyup":

$(document.body).on('keyup', goal, function () {

IE很烂。

相关文章: