示例代碼爲什麼不適用於DOM元素函數?
document.body.getAttribute.apply(this,['id']);
document.body.setAttribute.apply(this,['id','test']);
錯誤
火狐:
TypeError: 'setAttribute' called on an object that does not implement interface Element.
鉻:
Uncaught TypeError: Illegal invocation
你從'的console.log得到什麼(這個)',因爲Firefox的錯誤信息清楚地表明, '這個'不是一個元素。 –