一个博客

包含「全局」标签的文章

共找到1个结果

  • 从重写全局函数window说起

    <p> 确实很有意思,原题目如下: </p> <blockquote> <p> <code class="js plain" style="line-height: 24px; white-space: pre-wrap; color: rgb(0, 0, 0); border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: rgb(0, 0, 0) !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: 'Courier New', Consolas, 'Bitstream Vera Sans Mono', Courier, monospace !important; min-height: auto !important;">window.alert = </code><code class="js keyword" style="line-height: 24px; white-space: pre-wrap; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: rgb(0, 0, 0) !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: 'Courier New', Consolas, 'Bitstream Vera Sans Mono', Courier, monospace !important; min-height: auto !important; color: rgb(0, 0, 255) !important;">function</code><code class="js plain" style="line-height: 24px; white-space: pre-wrap; color: rgb(0, 0, 0); border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: rgb(0, 0, 0) !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: 'Courier New', Consolas, 'Bitstream Vera Sans Mono', Courier, monospace !important; min-height: auto !important;">(){};______;alert(1); 填空,使后面的alert(1)能正确弹出,至少列举两种不同思路。</code> </p> </blockquote> <p> <code class="js plain" style="line-height: 24px; white-space: pre-wrap; color: rgb(0, 0, 0); border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: rgb(0, 0, 0) !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: 'Courier New', Consolas, 'Bitstream Vera Sans Mono', Courier, monospace !important; min-height: auto !important;">一开始我只想到了delete掉这个重写的方法,以及从原window的原型链中找回原来的alert方法(结果这两种兼容性都不好),不过作者给出了几个很不错的办法,很有意思。...</code></p>

1 / 1