按鍵事件在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