阅读背景:

如何使用匿名函数removeEventListener是addEventListener?

来源:互联网 
function doSomethingWith(param)
{
    document.body.addEventListener(
        'scroll',
        function()
        {
            document.write(param);
        },
        false
    ); // An event that I want to remove later
}
setTimeout(
    function()
    {
        document.body.removeEventListener('scroll', HANDLER ,false);
            // What HANDLER should I specify to remove the anonymous handler above?
    },
    3000
);
doSomethingWith('Test. ');
function doSomethingWith(param)
{
    document.



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: