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

查看:372
本文介绍了百度分享中一段奇怪的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怎么理解?

解决方案

https://segmentfault.com/q/10...

这篇关于百度分享中一段奇怪的JavaScript代码如何理解(尤其是with(document)0[...]中的数字0怎么理解)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆