求解读这段JS代码

var c, _ = Function;
    with( o = document.getElementById("welcome")) {
        innerHTML += innerHTML;
        onmouseover = _("c=1");
        onmouseout = _("c=0");
    }( F = _("if(#%27||!c)#++,#%=o.scrollHeight>>1;setTimeout(F,#%27?10:2000);".replace(/#/g, "o.scrollTop")))(); 

求高人解读以上代码,谢谢

阅读 2.5k
2 个回答
var c,o = document.getElementById("welcome");
o.innerHTML += o.innerHTML;
o.onmouseover = function () {
    c=1;
}
o.onmouseout = function () {
    c=0;
}
function F() {
    if (o.scrollTop % 27 || !c) o.scrollTop++, o.scrollTop %= o.scrollHeight >> 1;
    setTimeout(F, o.scrollTop % 27 ? 10 : 2000);
}
F();

改成这样 就看的懂了吧,

用with 真不是什么好习惯;

程序的大致意思 就是 控制 welcome 这个元素的scrollTop

1.先去掉_,转义特殊字符
var c, _ = Function;
with( o = document.getElementById("welcome")) {
innerHTML += innerHTML;
onmouseover = function(){c=1;};
onmouseout = function(){c=0;};
}( F =function(){if(o.scrollTop'||!c)o.scrollTop++,o.scrollTop%=o.scrollHeight>>1;setTimeout(F,o.scrollTop'?10:2000);})();

推荐问题
logo
101 新手上路
子站问答
访问
宣传栏