按键事件在Mozilla Firefox中不起作用。 我已经创建了一个动态的表格行,里面有一个文本boix,而且文本框也有一个按键事件。按键事件在Mozilla Firefox中不起作用
var el = document.createElement('input');
el.type = 'text';
el.name = 'suggest2';
el.setAttribute("id",str2);
el.setAttribute("onkeypress","additemifenter(this.id)");
cell2.appendChild(el);
row.appendChild(cell2);
在谷歌浏览器中调用函数additemifenter(this.id)。但在Firefox中,该功能没有得到执行。什么是在Firefox中做到这一点的替代方法?
重复:http://stackoverflow.com/questions/95731/为什么这样做 - onclick-property-set-with-setattribute-fail-to-work-in-ie – davin 2011-06-04 08:54:05