function remove(salNum) {
var fld
fld = document.getElementById('salary' + salNum);
fld.value = 0;
document.forms[0].submit();
}
FireBug控制台中的输出给出错误:
fld is null
fld.value = 0;
我错过了什么?
答案 0 :(得分:1)
如果您要删除的元素已被删除或html已被更改,请尝试此操作:
function remove(salNum) {
var fld
fld = document.getElementById('salary' + salNum);
// check for element existance
if( fld ) fld.value = 0;
document.forms[0].submit();
}