日期:2014-05-17  浏览次数:20607 次

Firefox下操作html对象
function write_in()
{
	var attend_days = document.getElementById("a_d").value;
	var huoshi = document.getElementById("hs").value;
	var weisheng = document.getElementById("ws").value;
	var shui = document.getElementById("s").value;
	var length = document.getElementsByName("depart_payroll[payroll_atts][][attend_days]").length;
	for (var i = 0; i < length; i++) {
		document.getElementsByName("depart_payroll[payroll_atts][][attend_days]")[i].value = attend_days;
		document.getElementsByName("depart_payroll[payroll_atts][][huoshi]")[i].value = huoshi;
		document.getElementsByName("depart_payroll[payroll_atts][][weisheng]")[i].value = weisheng;
		document.getElementsByName("depart_payroll[payroll_atts][][shui]")[i].value = shui;
	}
}

IE下对文本框对象进行赋值用 innerText,FF下好像不支持,转而使用innerHTML,但也宣告失败,结果竟然使用value就可以了。不明白!

FF 一般用 textContent代替IE 的innerText