1

注入的元素,如果我嘗試在另一個mootools的失敗,在一個又一個的底部上即

var div = new Element('div', { id: 'thediv' }).inject(anotherdiv, 'bottom'); 

底部注入的元素,我得到

SCRIPT5007: Unable to get value of the property 'appendChild': object is null or undefined 
mootools-core-1.3.2-full-compat.js, line 3437 character 3 

這些都是線,導致mootools1.3.2中的錯誤

bottom: function(context, element){ 
    element.appendChild(context); 
}, 

我該如何解決這個問題?

回答

2

這就是你的錯誤,如果anotherdiv沒有一個的appendChild方法,例如,如果anotherdiv存在之前運行腳本,或者尚未分配的值是一個DOM元素。

相關問題