![](/img/trans.png)
[英]having an issue with IE8 - with a script that works on the other browsers perfectly
[英]Script runs perfectly in all other browsers but IE
此代碼塊在所有其他瀏覽器中都可以正常工作。 當我進行頁面的硬刷新時,它確實可以在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中,它也可以正常工作。 但是在我的開發環境中,重新加載頁面后(在軟刷新后),它不起作用。
弄清楚了。 如果有人遇到此問題,只需將此類問題的“輸入”功能類型更改為“鍵”即可:
$(document.body).on('keyup', goal, function () {
IE很爛。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.