Is there a way to access the DOM from the event fired by DOMContentLoaded
?
window.addEventListener("load", function() { myExtension.init(); }, false);
var myExtension = {
init: function() {
var appcontent = document.getElementById("appcontent"); // browser
if(appcontent)
appcontent.addEve开发者_如何学PythonntListener("DOMContentLoaded", myExtension.onPageLoad, true);
},
onPageLoad: function(aEvent) {
//how to access to the DOM from aEvent??
},
}
From https://developer.mozilla.org/en/Code_snippets/On_page_load
Just the first line in onPageLoad
on the page you linked to shows how:
var doc = aEvent.originalTarget; // doc is document that triggered "onload" event
This gives you the document
element of the website.
精彩评论