百度分享中一段奇怪的JavaScript代码如何理解(尤其是with(document)0[...]中的数字0怎么理解)?

百度分享(http://share.baidu.com/code/a...中的JavaScript代码如下:

<script>
     window._bd_share_config = {
         "common": {
             "bdSnsKey": {},
             "bdText": "",
             "bdMini": "2",
             "bdMiniList": ["mshare", "copy", "weixin", "qzone", "tsina", "bdysc", "douban", "renren", "tqq",
                 "bdxc", "sqq", "tqf", "tieba", "bdhome", "ibaidu", "fx", "youdao", "sdo", "qingbiji", "mail",
                 "isohu", "ty", "h163", "evernotecn", "print"],
             "bdPic": "",
             "bdStyle": "1",
             "bdSize": "24"
         }, "slide": {"type": "slide", "bdImg": "1", "bdPos": "right", "bdTop": "100"}
     };
     with(document)0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src =
         'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];
</script>

这段代码共两条语句,前面一条声明一个对象,这不难理解;但第二条语句如何理解?尤其是with(document)0[...]中的数字0怎么理解?

阅读 5.7k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题