当前位置: 代码迷 >> HTML/CSS >> Firefox上操作html对象
  详细解决方案

Firefox上操作html对象

热度:109   发布时间:2012-10-31 14:37:32.0
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
  相关解决方案