0
有沒有方法從DOMContentLoaded
發起的事件訪問DOM?從DOMContentLoaded事件訪問DOM?
window.addEventListener("load", function() { myExtension.init(); }, false);
var myExtension = {
init: function() {
var appcontent = document.getElementById("appcontent"); // browser
if(appcontent)
appcontent.addEventListener("DOMContentLoaded", myExtension.onPageLoad, true);
},
onPageLoad: function(aEvent) {
//how to access to the DOM from aEvent??
},
}
從https://developer.mozilla.org/en/Code_snippets/On_page_load