[removed] not working for me?

前端 未结 8 1947
栀梦
栀梦 2021-02-07 14:17

Well I\'m simply playing around with a userscript of GreaseMonkey and here\'s just something simple I attempt to do;

function test() {
document.getElementById(\'         


        
8条回答
  •  野性不改
    2021-02-07 14:54

    If you are using Greasemonkey then you don't really need a using onload event since the Greasemoneky script is called only when DOMContentLoaded is fired.

    The code in a Greasemonkey user script gets invoked when the DOMContentLoaded event fires (during event capture as of GM 0.8.6). It is a DOM event implemented by Mozilla, similar to window.onload. However, since it waits only for the DOM to load, instead of the entire page (including images, style sheets, and etc.) it happens sooner.

    http://wiki.greasespot.net/DOMContentLoaded

    I think you would just need to call test() without any event listeners.

提交回复
热议问题