<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.feedsky.com/styles/feedsky0.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feed.feedsky.com/r57c" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feed.feedsky.com/r57c" type="application/rss+xml"></fs:self_link><lastBuildDate>Tue, 07 Feb 2012 00:55:26 GMT</lastBuildDate><title>断桥残雪部落格</title><description>专注前端开发，分享JS、jQuery、PHP、CSS、WEB开发技巧</description><link>http://js8.in</link><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>1</sy:updateFrequency><language>en</language><pubDate>Wed, 08 Feb 2012 11:59:56 GMT</pubDate><item><title>windows搭建memcached环境</title><link>http://item.feedsky.com/~feedsky/r57c/~8361098/603145389/6028780/1/item.html</link><content:encoded>&lt;p&gt;最近练手php，一个地方需要缓存来支持，想来想去还是用&lt;strong&gt;memcached&lt;/strong&gt;做缓存，可是电脑是windows系统，如果是linux系统安装memcached就比较容易，敲入几行shell就搞定，windows下还没搞过，于是记录下过程，备用。&lt;/p&gt;
&lt;h2&gt;Windows下的Memcache安装&lt;/h2&gt;
&lt;p&gt;1、下载memcache for windows。下载地址：&lt;a target=&quot;_blank&quot; target=&quot;_blank&quot; href=&quot;http://jehiah.cz/projects/memcached-win32&quot;&gt;http://jehiah.cz/projects/memcached-win32&lt;/a&gt;，推荐下载binaries版本，解压(本例中解压到c:\\memcached)。&lt;br /&gt;
2、在命令行状态下输入： c:\\memcached\\memcached.exe -d install 。至此memcached已经安装成windows服务&lt;br /&gt;
3、在命令行下输入： c:\\memcached\\memcached.exe -d start 以启动&lt;strong&gt;memcached服务&lt;/strong&gt;。当然也可以选择在windows服务中启动&lt;br /&gt;
你没看错，就是这么简单，简简单单的三步memcache的服务器端就准备完毕&lt;/p&gt;
&lt;h2&gt;php安装Memcached模块支持&lt;/h2&gt;
&lt;p&gt;1、下载&lt;strong&gt;php_memcache.dll&lt;/strong&gt;模块，你可以从&lt;a target=&quot;_blank&quot; target=&quot;_blank&quot; href=&quot;http://downloads.php.net/pierre/&quot;&gt;http://downloads.php.net/pierre/&lt;/a&gt;找到对应的版本，&lt;br /&gt;
php5.3的直接下载&lt;a target=&quot;_blank&quot; target=&quot;_blank&quot; href=&quot;http://shikii.net/blog/downloads/php_memcache-cvs-20090703-5.3-VC6-x86.zip&quot;&gt;http://shikii.net/blog/downloads/php_memcache-cvs-20090703-5.3-VC6-x86.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;2、修改php.ini，添加如下内容：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;html&quot; style=&quot;font-family:monospace;&quot;&gt;extension=php_memcache.dll&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3、重启apache服务器，然后查看一下phpinfo，如果有memcache，那么就说明安装成功！&lt;/p&gt;
&lt;h2&gt;测试windows下的Memcached&lt;/h2&gt;
&lt;p&gt;测试代码如下：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;php&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span style=&quot;color: #000088;&quot;&gt;$mem&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Memcache&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000088;&quot;&gt;$mem&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;connect&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;127.0.0.1&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;11211&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000088;&quot;&gt;$mem&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'key'&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;'Hello Memcached!'&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;60&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$mem&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'key'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;更多测试代码，需要移步：&lt;br /&gt;
&lt;a target=&quot;_blank&quot; target=&quot;_blank&quot; href=&quot;http://www.php.net/manual/en/memcache.examples-overview.php&quot;&gt;http://www.php.net/manual/en/memcache.examples-overview.php&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Memcached的基本设置&lt;/h2&gt;
&lt;p&gt;&lt;span id=&quot;more-946&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;-p 监听的端口&lt;br /&gt;
-l 连接的IP地址, 默认是本机&lt;br /&gt;
-d start 启动memcached服务&lt;br /&gt;
-d restart 重起memcached服务&lt;br /&gt;
-d stop|shutdown 关闭正在运行的memcached服务&lt;br /&gt;
-d install 安装memcached服务&lt;br /&gt;
-d uninstall 卸载memcached服务&lt;br /&gt;
-u 以的身份运行 (仅在以root运行的时候有效)&lt;br /&gt;
-m 最大内存使用，单位MB。默认64MB&lt;br /&gt;
-M 内存耗尽时返回错误，而不是删除项&lt;br /&gt;
-c 最大同时连接数，默认是1024&lt;br /&gt;
-f 块大小增长因子，默认是1.25&lt;br /&gt;
-n 最小分配空间，key+value+flags默认是48&lt;br /&gt;
-h 显示帮助&lt;/p&gt;&lt;/blockquote&gt;
&lt;h3&gt;Memcache安装参考资源&lt;/h3&gt;
&lt;p&gt;&lt;a target=&quot;_blank&quot; target=&quot;_blank&quot; href=&quot;http://www.codeforest.net/how-to-install-memcached-on-windows-machine&quot;&gt;http://www.codeforest.net/how-to-install-memcached-on-windows-machine&lt;/a&gt;&lt;br /&gt;
&lt;a target=&quot;_blank&quot; target=&quot;_blank&quot; href=&quot;http://shikii.net/blog/installing-memcached-for-php-5-3-on-windows-7/&quot;&gt;http://shikii.net/blog/installing-memcached-for-php-5-3-on-windows-7/&lt;/a&gt;
&lt;div class=&quot;copyright&quot;&gt;
&lt;strong&gt;声明：&lt;/strong&gt;文章未声明为原创文章，本文链接 &lt;a href=&quot;http://js8.in/946.html&quot; title=&quot;windows搭建memcached环境&quot;&gt;http://js8.in/946.html&lt;/a&gt;. 转载请注明转自&lt;a href=&quot;http://js8.in&quot; title=&quot;前端开发博客&quot;&gt; JS8.IN ™&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;box-title&quot;&gt;随机文章&lt;/h3&gt;
&lt;ul class=&quot;box_random&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/630.html&quot; title=&quot;我开发的新浪微博应用：微博送祝福&quot; rel=&quot;bookmark inlinks&quot;&gt;我开发的新浪微博应用：微博送祝福&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/291.html&quot; title=&quot;手把手教你偷老师课件甚至考试试题！&quot; rel=&quot;bookmark inlinks&quot;&gt;手把手教你偷老师课件甚至考试试题！&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/731.html&quot; title=&quot;IE的fireEvent方法&quot; rel=&quot;bookmark inlinks&quot;&gt;IE的fireEvent方法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/519.html&quot; title=&quot;windows下安装基于Apache的SVN服务器&quot; rel=&quot;bookmark inlinks&quot;&gt;windows下安装基于Apache的SVN服务器&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/537.html&quot; title=&quot;承接企业网站建设，企业建站工作&quot; rel=&quot;bookmark inlinks&quot;&gt;承接企业网站建设，企业建站工作&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/703.html&quot; title=&quot;javascript事件：获取事件对象getEvent函数&quot; rel=&quot;bookmark inlinks&quot;&gt;javascript事件：获取事件对象getEvent函数&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/9.html&quot; title=&quot;生日party&quot; rel=&quot;bookmark inlinks&quot;&gt;生日party&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/46.html&quot; title=&quot;如何写网站的robots.txt和meta name robots的配置&quot; rel=&quot;bookmark inlinks&quot;&gt;如何写网站的robots.txt和meta name robots的配置&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;small&gt;© 三水清 for &lt;a href=&quot;http://js8.in&quot;&gt;三水清&lt;/a&gt;, 2012. |
&lt;a href=&quot;http://js8.in/946.html#comments&quot;&gt;No comment&lt;/a&gt; |在微博关注我：&lt;a href=&quot;//weibo.com/sanshuiqing&quot; target=&quot;_blank&quot; title=&quot;关注断桥残雪的新浪微博&quot;&gt;@清-三水清&lt;/a&gt;
&lt;br/&gt;收藏到：
&lt;a rel=&quot;nofollow&quot; href=&quot;http://share.renren.com/share/buttonshare.do?link=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到人人网&quot; target=&quot;_blank&quot;&gt;人人网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.douban.com/recommend/?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到豆瓣&quot; target=&quot;_blank&quot;&gt;豆瓣&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&amp;rurl=%posturl%&quot; title=&quot;收藏本文到开心网&quot; target=&quot;_blank&quot;&gt;开心网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://shuqian.qq.com/post?title=%posttitle%&amp;%20uri=%posturl%&quot; title=&quot;收藏本文到QQ书签&quot; target=&quot;_blank&quot;&gt;QQ书签&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.sina.com.cn/share/share.php?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到新浪微博&quot; target=&quot;_blank&quot;&gt;新浪微博&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.qq.com/share/share.php?title=%posttitle%&amp;url=%posturl%&amp;site=http://www.kaixin100.info&quot; title=&quot;收藏本文到腾讯微博&quot; target=&quot;_blank&quot;&gt;腾讯微博&lt;/a&gt;
&lt;br/&gt;
Post tags: &lt;a href=&quot;http://js8.in/tag/memcached&quot; rel=&quot;tag&quot;&gt;memcached&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/php&quot; rel=&quot;tag&quot;&gt;php&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/%e7%bc%93%e5%ad%98&quot; rel=&quot;tag&quot;&gt;缓存&lt;/a&gt;&lt;br/&gt;
&lt;/small&gt;&lt;/p&gt;&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;PHP实现javascript的escape和unescape函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F941.html&amp;from=http%3A%2F%2Fjs8.in%2F946.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2012/01/29/14457910.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;PHP实现javascript的escape和unescape函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;通过PHP批量下载图片文件&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F586.html&amp;from=http%3A%2F%2Fjs8.in%2F946.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10977771.gif&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;通过PHP批量下载图片文件&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;linux安装PHP加速器eAccelerator&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F888.html&amp;from=http%3A%2F%2Fjs8.in%2F946.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/09/15/12184400.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;linux安装PHP加速器eAccelerator&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;cURL常用的几个PHP函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F379.html&amp;from=http%3A%2F%2Fjs8.in%2F946.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11018919.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;cURL常用的几个PHP函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/603145389/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/603145389/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://js8.in/946.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>最近练手php，一个地方需要缓存来支持，想来想去还是用memcached做缓存，可是电脑是windows系统，如果是linux系统安装memcached就比较容易，敲入几行shell就搞定，windows下还没搞过，于是记录下过程，备用。
Windows下的Memcache安装
1、下载memcache for windows。下载地址：http://jehiah.cz/projects/memcached-win32，推荐下载binaries版本，解压(本例中解压到c:\\memcached)。
2、在命令行状态下输入： c:\\memcached\\memcached.exe -d install 。至此memcached已经安装成windows服务
3、在命令行下输入： c:\\memcached\\memcached.exe -d start 以启动memcached服务。当然也可以选择在windows服务中启动
你没看错，就是这么简单，简简单单的三步memcache的服务器端就准备完毕
php安装Memcached模块支持
1、下载php_memcache.dll模块，你可以从http://downloads.php.net/pierre/找到对应的版本，
php5.3的直接下载http://shikii.net/blog/downloads/php_memcache-cvs-20090703-5.3-VC6-x86.zip
2、修改php.ini，添加如下内容：

extension=php_memcache.dll

3、重启apache服务器，然后查看一下phpinfo，如果有memcache，那么就说明安装成功！
测试windows下的Memcached
测试代码如下：

&amp;#60;?php
$mem = new Memcache;
$mem-&amp;#62;connect&amp;#40;&amp;#34;127.0.0.1&amp;#34;, 11211&amp;#41;;
$mem-&amp;#62;set&amp;#40;'key', 'Hello Memcached!', 0, 60&amp;#41;;
$val = $mem-&amp;#62;get&amp;#40;'key'&amp;#41;;
echo $val;

更多测试代码，需要移步：
http://www.php.net/manual/en/memcache.examples-overview.php
Memcached的基本设置

-p 监听的端口
-l 连接的IP地址, 默认是本机
-d start 启动memcached服务
-d restart 重起memcached服务
-d stop&amp;#124;shutdown 关闭正在运行的memcached服务
-d install 安装memcached服务
-d uninstall 卸载memcached服务
-u 以的身份运行 (仅在以root运行的时候有效)
-m 最大内存使用，单位MB。默认64MB
-M 内存耗尽时返回错误，而不是删除项
-c 最大同时连接数，默认是1024
-f 块大小增长因子，默认是1.25
-n 最小分配空间，key+value+flags默认是48
-h 显示帮助
Memcache安装参考资源
http://www.codeforest.net/how-to-install-memcached-on-windows-machine
http://shikii.net/blog/installing-memcached-for-php-5-3-on-windows-7/

声明：文章未声明为原创文章，本文链接 http://js8.in/946.html. 转载请注明转自 JS8.IN ™
随机文章

没见过这么不要脸的！——校内网太不厚道，无耻之
推荐六个在线制作Loading图标的网站
腾讯发布QQ2010 Beta优先体验版本
三种常见jQuery幻灯片（jQuery slider）制作教程
WordPress插件开发之Widget侧边栏挂件插件
谷歌退出中国的意图？
开博两年了：换了主题 改了名
Ubuntu安装NVidia驱动


© 三水清 for 三水清, 2012. &amp;#124;
No [...]&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;PHP实现javascript的escape和unescape函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F941.html&amp;from=http%3A%2F%2Fjs8.in%2F946.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2012/01/29/14457910.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;PHP实现javascript的escape和unescape函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;通过PHP批量下载图片文件&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F586.html&amp;from=http%3A%2F%2Fjs8.in%2F946.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10977771.gif&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;通过PHP批量下载图片文件&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;linux安装PHP加速器eAccelerator&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F888.html&amp;from=http%3A%2F%2Fjs8.in%2F946.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/09/15/12184400.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;linux安装PHP加速器eAccelerator&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;cURL常用的几个PHP函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F379.html&amp;from=http%3A%2F%2Fjs8.in%2F946.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11018919.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;cURL常用的几个PHP函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/603145389/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/603145389/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>缓存</category><category>php</category><category>memcached</category><pubDate>Tue, 07 Feb 2012 08:55:26 +0800</pubDate><author>三水清</author><comments>http://js8.in/946.html#comments</comments><guid isPermaLink="false">http://js8.in/?p=946</guid><dc:creator>三水清</dc:creator><fs:srclink>http://js8.in/946.html</fs:srclink><fs:srcfeed>http://www.js8.in/feed</fs:srcfeed><fs:itemid>feedsky/r57c/~8361098/603145389/6028780</fs:itemid></item><item><title>【PPT分享】XSS注入和防范</title><link>http://item.feedsky.com/~feedsky/r57c/~8361098/602762869/6028780/1/item.html</link><content:encoded>&lt;p&gt;这是我前些日子准备的关于《&lt;a target=&quot;_blank&quot; href=&quot;http://qdemo.sinaapp.com/ppt/xss/&quot; target=&quot;_blank&quot;&gt;XSS注入和防范&lt;/a&gt;》的技术分享ppt，现在放出来，之前是做的powderpoint文件，后来网上流传&lt;a target=&quot;_blank&quot; href=&quot;http://bartaz.github.com/impress.js&quot; target=&quot;_blank&quot;&gt;impress.js&lt;/a&gt;做ppt，于是自己也整了个impress.js版本的放在了SAE上面，经过测试发现当ppt的内容较多，带有图片等，&lt;strong&gt;impress.js&lt;/strong&gt;效果就会比较卡。不多说其他的，说说ppt的内容：&lt;/p&gt;
&lt;p&gt;《XSS注入和防范》主要从xss是什么，xss的危害，xss的类型及其防范的措施，几个方面来讲解xss。希望对大家理解xss有所帮助，另外多说句cookie的httponly方式，在apache下面有个漏洞，当cookie超过4k的时候就会出现泄漏，所以要注意这个漏洞！（具体代码：&lt;a target=&quot;_blank&quot; href=&quot;https://gist.github.com/1955a1c28324d4724b7b/7fe51f2a66c1d4a40a736540b3ad3fde02b7fb08&quot; target=&quot;_blank&quot;&gt;狂点此处&lt;/a&gt;）&lt;/p&gt;
&lt;p&gt;废话不多说了，上ppt地址：&lt;a target=&quot;_blank&quot; href=&quot;http://qdemo.sinaapp.com/ppt/xss&quot; target=&quot;_blank&quot;&gt;【PPT分享】XSS注入和防范&lt;/a&gt;，请使用支持chrome浏览器查看ppt页面&lt;br /&gt;
&lt;div id=&quot;attachment_952&quot; class=&quot;wp-caption aligncenter&quot; style=&quot;width: 410px&quot;&gt;&lt;a href=&quot;http://js8.in/951.html/02-06_152043&quot; rel=&quot;attachment wp-att-952&quot;&gt;&lt;img src=&quot;http://js8.in/wp-content/uploads/2012/02/02-06_152043.png&quot; alt=&quot;XSS注入和防范&quot; title=&quot;XSS注入和防范&quot; width=&quot;400&quot; height=&quot;284&quot; class=&quot;size-full wp-image-952&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;XSS注入和防范&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span id=&quot;more-951&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;xss&lt;/strong&gt;是一种网站应用程序的安全漏洞攻击，是代码注入的一种。它允许恶意用户将代码注入到网页上，其他用户在观看网页时就会受到影响。这类攻击通常包含了HTML以及用户端脚本语言。
&lt;div class=&quot;copyright&quot;&gt;
&lt;strong&gt;声明：&lt;/strong&gt;文章未声明为原创文章，本文链接 &lt;a href=&quot;http://js8.in/951.html&quot; title=&quot;【PPT分享】XSS注入和防范&quot;&gt;http://js8.in/951.html&lt;/a&gt;. 转载请注明转自&lt;a href=&quot;http://js8.in&quot; title=&quot;前端开发博客&quot;&gt; JS8.IN ™&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;box-title&quot;&gt;随机文章&lt;/h3&gt;
&lt;ul class=&quot;box_random&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/944.html&quot; title=&quot;IE6中a标签触发图片和ajax请求被abort&quot; rel=&quot;bookmark inlinks&quot;&gt;IE6中a标签触发图片和ajax请求被abort&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/469.html&quot; title=&quot;jQuery 1.4.1 中文参考文档下载&quot; rel=&quot;bookmark inlinks&quot;&gt;jQuery 1.4.1 中文参考文档下载&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/544.html&quot; title=&quot;最新版WINDOWS 7 SP1下载地址出现&quot; rel=&quot;bookmark inlinks&quot;&gt;最新版WINDOWS 7 SP1下载地址出现&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/349.html&quot; title=&quot;发布一个Follow5的API PHP类&quot; rel=&quot;bookmark inlinks&quot;&gt;发布一个Follow5的API PHP类&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/677.html&quot; title=&quot;自己写的一个轻量级javascript框架的设计模式&quot; rel=&quot;bookmark inlinks&quot;&gt;自己写的一个轻量级javascript框架的设计模式&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/37.html&quot; title=&quot;“学长，你考研挺忙吧？！”&quot; rel=&quot;bookmark inlinks&quot;&gt;“学长，你考研挺忙吧？！”&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/20.html&quot; title=&quot;手把手图解教你使用PQ魔法师调节硬盘分区大小&quot; rel=&quot;bookmark inlinks&quot;&gt;手把手图解教你使用PQ魔法师调节硬盘分区大小&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/72.html&quot; title=&quot;发布一个仿QQSvr的dedecms模板&quot; rel=&quot;bookmark inlinks&quot;&gt;发布一个仿QQSvr的dedecms模板&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;small&gt;© 三水清 for &lt;a href=&quot;http://js8.in&quot;&gt;三水清&lt;/a&gt;, 2012. |
&lt;a href=&quot;http://js8.in/951.html#comments&quot;&gt;No comment&lt;/a&gt; |在微博关注我：&lt;a href=&quot;//weibo.com/sanshuiqing&quot; target=&quot;_blank&quot; title=&quot;关注断桥残雪的新浪微博&quot;&gt;@清-三水清&lt;/a&gt;
&lt;br/&gt;收藏到：
&lt;a rel=&quot;nofollow&quot; href=&quot;http://share.renren.com/share/buttonshare.do?link=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到人人网&quot; target=&quot;_blank&quot;&gt;人人网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.douban.com/recommend/?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到豆瓣&quot; target=&quot;_blank&quot;&gt;豆瓣&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&amp;rurl=%posturl%&quot; title=&quot;收藏本文到开心网&quot; target=&quot;_blank&quot;&gt;开心网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://shuqian.qq.com/post?title=%posttitle%&amp;%20uri=%posturl%&quot; title=&quot;收藏本文到QQ书签&quot; target=&quot;_blank&quot;&gt;QQ书签&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.sina.com.cn/share/share.php?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到新浪微博&quot; target=&quot;_blank&quot;&gt;新浪微博&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.qq.com/share/share.php?title=%posttitle%&amp;url=%posturl%&amp;site=http://www.kaixin100.info&quot; title=&quot;收藏本文到腾讯微博&quot; target=&quot;_blank&quot;&gt;腾讯微博&lt;/a&gt;
&lt;br/&gt;
Post tags: &lt;a href=&quot;http://js8.in/tag/ppt&quot; rel=&quot;tag&quot;&gt;PPT&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/xss&quot; rel=&quot;tag&quot;&gt;xss&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/%e5%ae%89%e5%85%a8&quot; rel=&quot;tag&quot;&gt;安全&lt;/a&gt;&lt;br/&gt;
&lt;/small&gt;&lt;/p&gt;&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;javascript入门到高级PPT&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F750.html&amp;from=http%3A%2F%2Fjs8.in%2F951.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979311.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;javascript入门到高级PPT&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;分享一个php验证码类，支持中文字母数字，还可自定义字体&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F646.html&amp;from=http%3A%2F%2Fjs8.in%2F951.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978884.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;分享一个php验证码类，支持中文字母数字，还可自定义字体&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;host配置：设置电脑DNS解析文件host&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F711.html&amp;from=http%3A%2F%2Fjs8.in%2F951.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978883.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;host配置：设置电脑DNS解析文件host&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;正确理解javascript的this关键字&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F851.html&amp;from=http%3A%2F%2Fjs8.in%2F951.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978049.gif&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;正确理解javascript的this关键字&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762869/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762869/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://js8.in/951.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>xss是一种网站应用程序的安全漏洞攻击，是代码注入的一种。它允许恶意用户将代码注入到网页上，其他用户在观看网页时就会受到影响。这类攻击通常包含了HTML以及用户端脚本语言。&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;javascript入门到高级PPT&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F750.html&amp;from=http%3A%2F%2Fjs8.in%2F951.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979311.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;javascript入门到高级PPT&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;分享一个php验证码类，支持中文字母数字，还可自定义字体&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F646.html&amp;from=http%3A%2F%2Fjs8.in%2F951.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978884.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;分享一个php验证码类，支持中文字母数字，还可自定义字体&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;关于jQuery ready()方法一些用法解释&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F603.html&amp;from=http%3A%2F%2Fjs8.in%2F951.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10977771.gif&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;关于jQuery ready()方法一些用法解释&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;最近很多找我做站的~&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F5.html&amp;from=http%3A%2F%2Fjs8.in%2F951.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11030166.gif&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;最近很多找我做站的~&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762869/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762869/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>web前端开发</category><category>xss</category><category>安全</category><category>PPT</category><pubDate>Mon, 06 Feb 2012 17:53:29 +0800</pubDate><author>三水清</author><comments>http://js8.in/951.html#comments</comments><guid isPermaLink="false">http://js8.in/?p=951</guid><dc:creator>三水清</dc:creator><fs:srclink>http://js8.in/951.html</fs:srclink><fs:srcfeed>http://www.js8.in/feed</fs:srcfeed><fs:itemid>feedsky/r57c/~8361098/602762869/6028780</fs:itemid></item><item><title>IE6中a标签触发图片和ajax请求被abort</title><link>http://item.feedsky.com/~feedsky/r57c/~8361098/602762870/6028780/1/item.html</link><content:encoded>&lt;h2&gt;IE6 a标签的请求被abort的原因&lt;/h2&gt;
&lt;p&gt;最近项目中掉进IE6 a标签abort两次坑，第一次是a标签绑定一个事件，&lt;code&gt;href='javascript:;'&lt;/code&gt;这样a标签触发了事件，切换验证码图片，结果验证码图片总是显示不出来，通过抓包显示状态为&lt;strong&gt;abort&lt;/strong&gt;。其实这个的原因可以从IE6中a标签执行顺序说起，IE6中a标签执行onclick在执行默认事件（即href跳转）之前，当触发了绑定的事件之后，那么处理完事件之后，如果不&lt;code&gt;return false&lt;/code&gt;或者阻止默认事件，则会继续执行href跳转，IE6会认为页面跳转到其他页面或者页面重新刷新，则abort之前&lt;strong&gt;onclick&lt;/strong&gt;事件中的请求。&lt;br /&gt;
&lt;span id=&quot;more-944&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;所以当onclick时，做出的获取最新验证码图片的请求，会因为下一步href的触发而abort。同时，如果你在a绑定的事件中做ajax请求，那么也会被无情的&lt;code&gt;abort&lt;/code&gt;。&lt;/p&gt;
&lt;h2&gt;IE6 a标签的请求被abort的解决方案&lt;/h2&gt;
&lt;p&gt;解决的方法就是在onclick或者绑定事件中&lt;code&gt;return false&lt;/code&gt;来阻止a标签跳转的默认事件。&lt;br /&gt;
例如下面的代码：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;html&quot; style=&quot;font-family:monospace;&quot;&gt;&amp;lt;a href=&amp;quot;javascript:void(0)&amp;quot; onclick=&amp;quot;fn();return false;&amp;quot;&amp;gt;Test&amp;lt;/a&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;或者你也可以给a标签的href写成“#”，即当前页面的锚点，这样页面就不会跳转，自然不会abort请求。&lt;/p&gt;
&lt;p&gt;最好的方式还是两种都用，保险！
&lt;div class=&quot;copyright&quot;&gt;
&lt;strong&gt;声明：&lt;/strong&gt;文章未声明为原创文章，本文链接 &lt;a href=&quot;http://js8.in/944.html&quot; title=&quot;IE6中a标签触发图片和ajax请求被abort&quot;&gt;http://js8.in/944.html&lt;/a&gt;. 转载请注明转自&lt;a href=&quot;http://js8.in&quot; title=&quot;前端开发博客&quot;&gt; JS8.IN ™&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;box-title&quot;&gt;随机文章&lt;/h3&gt;
&lt;ul class=&quot;box_random&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/731.html&quot; title=&quot;IE的fireEvent方法&quot; rel=&quot;bookmark inlinks&quot;&gt;IE的fireEvent方法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/453.html&quot; title=&quot;全世界都在笑中国傻&quot; rel=&quot;bookmark inlinks&quot;&gt;全世界都在笑中国傻&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/351.html&quot; title=&quot;使用CSS控制打印页面格式&quot; rel=&quot;bookmark inlinks&quot;&gt;使用CSS控制打印页面格式&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/23.html&quot; title=&quot;园艺学院网站内测！开始，欢迎访问&quot; rel=&quot;bookmark inlinks&quot;&gt;园艺学院网站内测！开始，欢迎访问&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/752.html&quot; title=&quot;使用html5 postMessage和window.name实现多浏览器跨域&quot; rel=&quot;bookmark inlinks&quot;&gt;使用html5 postMessage和window.name实现多浏览器跨域&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/681.html&quot; title=&quot;WinHttp.WinHttpRequest.5.1—可以用作抓取的msxml 4.0底层对象&quot; rel=&quot;bookmark inlinks&quot;&gt;WinHttp.WinHttpRequest.5.1—可以用作抓取的msxml 4.0底层对象&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/561.html&quot; title=&quot;推荐一款支持win7的超酷3D水纹屏保-Watery Desktop&quot; rel=&quot;bookmark inlinks&quot;&gt;推荐一款支持win7的超酷3D水纹屏保-Watery Desktop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/409.html&quot; title=&quot;巧用谷歌Reader订阅最新春运信息&quot; rel=&quot;bookmark inlinks&quot;&gt;巧用谷歌Reader订阅最新春运信息&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;small&gt;© 三水清 for &lt;a href=&quot;http://js8.in&quot;&gt;三水清&lt;/a&gt;, 2012. |
&lt;a href=&quot;http://js8.in/944.html#comments&quot;&gt;No comment&lt;/a&gt; |在微博关注我：&lt;a href=&quot;//weibo.com/sanshuiqing&quot; target=&quot;_blank&quot; title=&quot;关注断桥残雪的新浪微博&quot;&gt;@清-三水清&lt;/a&gt;
&lt;br/&gt;收藏到：
&lt;a rel=&quot;nofollow&quot; href=&quot;http://share.renren.com/share/buttonshare.do?link=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到人人网&quot; target=&quot;_blank&quot;&gt;人人网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.douban.com/recommend/?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到豆瓣&quot; target=&quot;_blank&quot;&gt;豆瓣&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&amp;rurl=%posturl%&quot; title=&quot;收藏本文到开心网&quot; target=&quot;_blank&quot;&gt;开心网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://shuqian.qq.com/post?title=%posttitle%&amp;%20uri=%posturl%&quot; title=&quot;收藏本文到QQ书签&quot; target=&quot;_blank&quot;&gt;QQ书签&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.sina.com.cn/share/share.php?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到新浪微博&quot; target=&quot;_blank&quot;&gt;新浪微博&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.qq.com/share/share.php?title=%posttitle%&amp;url=%posturl%&amp;site=http://www.kaixin100.info&quot; title=&quot;收藏本文到腾讯微博&quot; target=&quot;_blank&quot;&gt;腾讯微博&lt;/a&gt;
&lt;br/&gt;
Post tags: &lt;a href=&quot;http://js8.in/tag/abort&quot; rel=&quot;tag&quot;&gt;abort&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/a%e6%a0%87%e7%ad%be&quot; rel=&quot;tag&quot;&gt;a标签&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/ie6&quot; rel=&quot;tag&quot;&gt;IE6&lt;/a&gt;&lt;br/&gt;
&lt;/small&gt;&lt;/p&gt;&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6中a标签location.href失效解决方法&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&amp;from=http%3A%2F%2Fjs8.in%2F944.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/07/21/18318778.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6中a标签location.href失效解决方法&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6下javascript不能隐藏select标签的bug&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&amp;from=http%3A%2F%2Fjs8.in%2F944.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10987937.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6下javascript不能隐藏select标签的bug&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;最新版wBox 解决IE6 背景太小bug&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F506.html&amp;from=http%3A%2F%2Fjs8.in%2F944.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10977733.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;最新版wBox 解决IE6 背景太小bug&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6 PNG图片不透明问题的解决方法&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F380.html&amp;from=http%3A%2F%2Fjs8.in%2F944.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/09/01/2770440.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6 PNG图片不透明问题的解决方法&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762870/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762870/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://js8.in/944.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>IE6 a标签的请求被abort的原因
最近项目中掉进IE6 a标签abort两次坑，第一次是a标签绑定一个事件，href='javascript:;'这样a标签触发了事件，切换验证码图片，结果验证码图片总是显示不出来，通过抓包显示状态为abort。其实这个的原因可以从IE6中a标签执行顺序说起，IE6中a标签执行onclick在执行默认事件（即href跳转）之前，当触发了绑定的事件之后，那么处理完事件之后，如果不return false或者阻止默认事件，则会继续执行href跳转，IE6会认为页面跳转到其他页面或者页面重新刷新，则abort之前onclick事件中的请求。

所以当onclick时，做出的获取最新验证码图片的请求，会因为下一步href的触发而abort。同时，如果你在a绑定的事件中做ajax请求，那么也会被无情的abort。
IE6 a标签的请求被abort的解决方案
解决的方法就是在onclick或者绑定事件中return false来阻止a标签跳转的默认事件。
例如下面的代码：

&amp;#60;a href=&amp;#34;javascript:void(0)&amp;#34; onclick=&amp;#34;fn();return false;&amp;#34;&amp;#62;Test&amp;#60;/a&amp;#62;

或者你也可以给a标签的href写成“#”，即当前页面的锚点，这样页面就不会跳转，自然不会abort请求。
最好的方式还是两种都用，保险！

声明：文章未声明为原创文章，本文链接 http://js8.in/944.html. 转载请注明转自 JS8.IN ™
随机文章

javascript获取隐藏dom的宽高
ZBlog表情更新——柏夫版【超酷搞笑】
推荐六个在线制作Loading图标的网站
通过JSONP实现完美跨域
IE6中a标签location.href失效解决方法
关于jQuery ready()方法一些用法解释
拿福能中国千人挑战活动
linux安装PHP加速器eAccelerator


© 三水清 for 三水清, 2012. &amp;#124;
No comment &amp;#124;在微博关注我：@清-三水清
收藏到：
人人网 &amp;#124; 豆瓣 &amp;#124; 开心网 &amp;#124; QQ书签 &amp;#124; 新浪微博 &amp;#124; 腾讯微博

Post tags: abort, a标签, IE6
&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6中a标签location.href失效解决方法&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&amp;from=http%3A%2F%2Fjs8.in%2F944.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/07/21/18318778.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6中a标签location.href失效解决方法&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6下javascript不能隐藏select标签的bug&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&amp;from=http%3A%2F%2Fjs8.in%2F944.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10987937.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6下javascript不能隐藏select标签的bug&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;最新版wBox 解决IE6 背景太小bug&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F506.html&amp;from=http%3A%2F%2Fjs8.in%2F944.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10977733.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;最新版wBox 解决IE6 背景太小bug&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6 PNG图片不透明问题的解决方法&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F380.html&amp;from=http%3A%2F%2Fjs8.in%2F944.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/09/01/2770440.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6 PNG图片不透明问题的解决方法&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762870/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762870/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>web前端开发</category><category>IE6</category><category>a标签</category><category>abort</category><pubDate>Sat, 04 Feb 2012 15:28:10 +0800</pubDate><author>三水清</author><comments>http://js8.in/944.html#comments</comments><guid isPermaLink="false">http://js8.in/?p=944</guid><dc:creator>三水清</dc:creator><fs:srclink>http://js8.in/944.html</fs:srclink><fs:srcfeed>http://www.js8.in/feed</fs:srcfeed><fs:itemid>feedsky/r57c/~8361098/602762870/6028780</fs:itemid></item><item><title>PHP实现javascript的escape和unescape函数</title><link>http://item.feedsky.com/~feedsky/r57c/~8361098/602762871/6028780/1/item.html</link><content:encoded>&lt;p&gt;&lt;strong&gt;前端开发&lt;/strong&gt;工程师都知道javascript有编码函数&lt;code&gt;escape()&lt;/code&gt;和对应的解码函数&lt;code&gt;unescape()&lt;/code&gt;，而php中只有个urlencode和urldecode，这个编码和解码函数对encodeURI和encodeURIComponent有效，但是对&lt;strong&gt;escape&lt;/strong&gt;的是无效的。&lt;/p&gt;
&lt;p&gt;javascript中的escape()函数和unescape()函数用户字符串编码，类似于PHP中的urlencode()函数，下面是php实现的escape函数代码：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;php&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #009933; font-style: italic;&quot;&gt;/** 
 * js escape php 实现 
 * @param $string           the sting want to be escaped 
 * @param $in_encoding       
 * @param $out_encoding      
 */&lt;/span&gt; 
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; escape&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$string&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$in_encoding&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;'UTF-8'&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$out_encoding&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;'UCS-2'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; 
    &lt;span style=&quot;color: #000088;&quot;&gt;$return&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;''&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
    &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;function_exists&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'mb_get_info'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; 
        &lt;span style=&quot;color: #b1b100;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$x&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$x&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;mb_strlen&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$string&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$in_encoding&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$x&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; 
            &lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;mb_substr&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$string&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$in_encoding&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
            &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;strlen&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// 多字节字符 &lt;/span&gt;
                &lt;span style=&quot;color: #000088;&quot;&gt;$return&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;'%u'&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;strtoupper&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;bin2hex&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;mb_convert_encoding&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$out_encoding&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$in_encoding&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
            &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; 
                &lt;span style=&quot;color: #000088;&quot;&gt;$return&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;'%'&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;strtoupper&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;bin2hex&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
            &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; 
        &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; 
    &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; 
    &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$return&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;span id=&quot;more-941&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;对应的解码&lt;strong&gt;php unescape&lt;/strong&gt;代码是：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;php&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; unescape&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; 
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; 
    &lt;span style=&quot;color: #000088;&quot;&gt;$ret&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;''&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
    &lt;span style=&quot;color: #000088;&quot;&gt;$len&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;strlen&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
    &lt;span style=&quot;color: #b1b100;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$len&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; 
    &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; 
        &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;'%'&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;'u'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; 
        &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; 
            &lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;hexdec&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;substr&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
            &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #208080;&quot;&gt;0x7f&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; 
                &lt;span style=&quot;color: #000088;&quot;&gt;$ret&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;chr&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
            &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt;  
                &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #208080;&quot;&gt;0x800&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; 
                    &lt;span style=&quot;color: #000088;&quot;&gt;$ret&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;chr&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #208080;&quot;&gt;0xc0&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; 
                     &lt;span style=&quot;color: #990000;&quot;&gt;chr&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #208080;&quot;&gt;0x80&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #208080;&quot;&gt;0x3f&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
                &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; 
                    &lt;span style=&quot;color: #000088;&quot;&gt;$ret&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;chr&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #208080;&quot;&gt;0xe0&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; 
                     &lt;span style=&quot;color: #990000;&quot;&gt;chr&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #208080;&quot;&gt;0x80&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #208080;&quot;&gt;0x3f&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; 
                     &lt;span style=&quot;color: #990000;&quot;&gt;chr&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #208080;&quot;&gt;0x80&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #208080;&quot;&gt;0x3f&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
            &lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
        &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt;  
            &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;'%'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; 
            &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; 
                &lt;span style=&quot;color: #000088;&quot;&gt;$ret&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;urldecode&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;substr&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
                &lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
            &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; 
                &lt;span style=&quot;color: #000088;&quot;&gt;$ret&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.=&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
    &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; 
    &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$ret&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; 
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;copyright&quot;&gt;
&lt;strong&gt;声明：&lt;/strong&gt;文章未声明为原创文章，本文链接 &lt;a href=&quot;http://js8.in/941.html&quot; title=&quot;PHP实现javascript的escape和unescape函数&quot;&gt;http://js8.in/941.html&lt;/a&gt;. 转载请注明转自&lt;a href=&quot;http://js8.in&quot; title=&quot;前端开发博客&quot;&gt; JS8.IN ™&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;box-title&quot;&gt;随机文章&lt;/h3&gt;
&lt;ul class=&quot;box_random&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/496.html&quot; title=&quot;WordPress博客的 SEO 技巧&quot; rel=&quot;bookmark inlinks&quot;&gt;WordPress博客的 SEO 技巧&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/446.html&quot; title=&quot;谷歌要退出中国大陆市场？！&quot; rel=&quot;bookmark inlinks&quot;&gt;谷歌要退出中国大陆市场？！&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/471.html&quot; title=&quot;简单修改.htaccess来提高Yslow等级&quot; rel=&quot;bookmark inlinks&quot;&gt;简单修改.htaccess来提高Yslow等级&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/42.html&quot; title=&quot;ZBlog表情更新——柏夫版【超酷搞笑】&quot; rel=&quot;bookmark inlinks&quot;&gt;ZBlog表情更新——柏夫版【超酷搞笑】&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/19.html&quot; title=&quot;学校DNS被人劫持啦！！！&quot; rel=&quot;bookmark inlinks&quot;&gt;学校DNS被人劫持啦！！！&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/373.html&quot; title=&quot;推荐六个在线制作Loading图标的网站&quot; rel=&quot;bookmark inlinks&quot;&gt;推荐六个在线制作Loading图标的网站&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/526.html&quot; title=&quot;Ubuntu安装Samba实现跟windows文件共享&quot; rel=&quot;bookmark inlinks&quot;&gt;Ubuntu安装Samba实现跟windows文件共享&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/5.html&quot; title=&quot;最近很多找我做站的~&quot; rel=&quot;bookmark inlinks&quot;&gt;最近很多找我做站的~&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;small&gt;© 三水清 for &lt;a href=&quot;http://js8.in&quot;&gt;三水清&lt;/a&gt;, 2012. |
&lt;a href=&quot;http://js8.in/941.html#comments&quot;&gt;No comment&lt;/a&gt; |在微博关注我：&lt;a href=&quot;//weibo.com/sanshuiqing&quot; target=&quot;_blank&quot; title=&quot;关注断桥残雪的新浪微博&quot;&gt;@清-三水清&lt;/a&gt;
&lt;br/&gt;收藏到：
&lt;a rel=&quot;nofollow&quot; href=&quot;http://share.renren.com/share/buttonshare.do?link=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到人人网&quot; target=&quot;_blank&quot;&gt;人人网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.douban.com/recommend/?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到豆瓣&quot; target=&quot;_blank&quot;&gt;豆瓣&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&amp;rurl=%posturl%&quot; title=&quot;收藏本文到开心网&quot; target=&quot;_blank&quot;&gt;开心网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://shuqian.qq.com/post?title=%posttitle%&amp;%20uri=%posturl%&quot; title=&quot;收藏本文到QQ书签&quot; target=&quot;_blank&quot;&gt;QQ书签&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.sina.com.cn/share/share.php?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到新浪微博&quot; target=&quot;_blank&quot;&gt;新浪微博&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.qq.com/share/share.php?title=%posttitle%&amp;url=%posturl%&amp;site=http://www.kaixin100.info&quot; title=&quot;收藏本文到腾讯微博&quot; target=&quot;_blank&quot;&gt;腾讯微博&lt;/a&gt;
&lt;br/&gt;
Post tags: &lt;a href=&quot;http://js8.in/tag/escape&quot; rel=&quot;tag&quot;&gt;escape&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/php&quot; rel=&quot;tag&quot;&gt;php&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/unescape&quot; rel=&quot;tag&quot;&gt;unescape&lt;/a&gt;&lt;br/&gt;
&lt;/small&gt;&lt;/p&gt;&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;PHP生成RSS类：RSS.class.php&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F412.html&amp;from=http%3A%2F%2Fjs8.in%2F941.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979694.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;PHP生成RSS类：RSS.class.php&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;21个常用的 PHP 代码汇总&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F457.html&amp;from=http%3A%2F%2Fjs8.in%2F941.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/10/06/8663981.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;21个常用的 PHP 代码汇总&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;cURL常用的几个PHP函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F379.html&amp;from=http%3A%2F%2Fjs8.in%2F941.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11018919.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;cURL常用的几个PHP函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;PHP二维数组去重复项函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F475.html&amp;from=http%3A%2F%2Fjs8.in%2F941.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/09/10473995.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;PHP二维数组去重复项函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762871/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762871/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://js8.in/941.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>前端开发工程师都知道javascript有编码函数escape()和对应的解码函数unescape()，而php中只有个urlencode和urldecode，这个编码和解码函数对encodeURI和encodeURIComponent有效，但是对escape的是无效的。
javascript中的escape()函数和unescape()函数用户字符串编码，类似于PHP中的urlencode()函数，下面是php实现的escape函数代码：

/** 
 * js escape php 实现 
 * @param $string           the sting want to be escaped 
 * @param $in_encoding       
 * @param $out_encoding      
 */ 
function escape&amp;#40;$string, $in_encoding = 'UTF-8',$out_encoding = 'UCS-2'&amp;#41; [...]&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;PHP生成RSS类：RSS.class.php&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F412.html&amp;from=http%3A%2F%2Fjs8.in%2F941.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979694.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;PHP生成RSS类：RSS.class.php&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;21个常用的 PHP 代码汇总&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F457.html&amp;from=http%3A%2F%2Fjs8.in%2F941.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/10/06/8663981.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;21个常用的 PHP 代码汇总&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;cURL常用的几个PHP函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F379.html&amp;from=http%3A%2F%2Fjs8.in%2F941.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11018919.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;cURL常用的几个PHP函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;PHP二维数组去重复项函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F475.html&amp;from=http%3A%2F%2Fjs8.in%2F941.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/09/10473995.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;PHP二维数组去重复项函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762871/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762871/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>php</category><category>escape</category><category>JavaScript</category><category>unescape</category><pubDate>Fri, 03 Feb 2012 12:57:03 +0800</pubDate><author>三水清</author><comments>http://js8.in/941.html#comments</comments><guid isPermaLink="false">http://js8.in/?p=941</guid><dc:creator>三水清</dc:creator><fs:srclink>http://js8.in/941.html</fs:srclink><fs:srcfeed>http://www.js8.in/feed</fs:srcfeed><fs:itemid>feedsky/r57c/~8361098/602762871/6028780</fs:itemid></item><item><title>javascript contains方法来判断元素包含关系</title><link>http://item.feedsky.com/~feedsky/r57c/~8361098/602762872/6028780/1/item.html</link><content:encoded>&lt;p&gt;IE中的&lt;strong&gt;contains&lt;/strong&gt;方法可以判断A元素是否包含B元素，如果包含则返回true，否则返回false，在开发中会在事件代理处理上面用到。W3C的方法是&lt;strong&gt;compareDocumentPosition&lt;/strong&gt;，所以综上来说：JS通过contains和compareDocumentPosition方法来确定DOM节点间的关系,判断一个元素(对象)是否为另一个元素的子元素。&lt;br /&gt;
IE的contains方法很简单，但是W3C的&lt;code&gt;DOMElement.contains(DOMNode)&lt;/code&gt;方法会返回却是一个数值。&lt;/p&gt;
&lt;h2&gt;DOMElement.contains(DOMNode)&lt;/h2&gt;
&lt;p&gt;link：&lt;a target=&quot;_blank&quot; target=&quot;_blank&quot; href=&quot;https://developer.mozilla.org/En/DOM/Node.compareDocumentPosition&quot;&gt;https://developer.mozilla.org/En/DOM/Node.compareDocumentPosition&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;DOMElement.contains(DOMNode)&lt;/code&gt;返回的不是一个布尔值，而是一个很奇怪的数值，它是通过如下方式累加计算出来的：&lt;/p&gt;
&lt;table class=&quot;filament_table&quot; cellspacing=&quot;0&quot; width=&quot;80%&quot; rules=&quot;cols&quot; border=&quot;1&quot;&gt;
&lt;colgroup&gt;
&lt;col class=&quot;grey&quot; width=&quot;20%&quot;&gt;
&lt;col class=&quot;yellow&quot; width=&quot;20%&quot;&gt;
&lt;col class=&quot;grey&quot;&gt;
      &lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Bits&lt;/th&gt;
&lt;th&gt;Number&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;000000&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;元素一致&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;000001&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;节点在不同的文档（或者一个在文档之外）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;000010&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;节点 B 在节点 A 之前&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;000100&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;节点 A 在节点 B 之前 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;001000&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;节点 B 包含节点 A&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;010000&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;节点 A 包含节点 B&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100000 &lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;浏览器的私有使用 &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;span id=&quot;more-934&quot;&gt;&lt;/span&gt;&lt;br /&gt;
综上，来个@司徒正美 大大的方案：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; contains  &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;root&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; el&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	 &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;root.&lt;span style=&quot;color: #660066;&quot;&gt;compareDocumentPosition&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;
		 &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;return&lt;/span&gt; root &lt;span style=&quot;color: #339933;&quot;&gt;===&lt;/span&gt; el &lt;span style=&quot;color: #339933;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!!&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;root.&lt;span style=&quot;color: #660066;&quot;&gt;compareDocumentPosition&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;el&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;16&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	 &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;root.&lt;span style=&quot;color: #660066;&quot;&gt;contains&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; el.&lt;span style=&quot;color: #660066;&quot;&gt;nodeType&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;===&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		 &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;return&lt;/span&gt; root.&lt;span style=&quot;color: #660066;&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;el&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; root &lt;span style=&quot;color: #339933;&quot;&gt;!==&lt;/span&gt; el&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	 &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
	 &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;el &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; el.&lt;span style=&quot;color: #660066;&quot;&gt;parentNode&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;
		 &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;el &lt;span style=&quot;color: #339933;&quot;&gt;===&lt;/span&gt; root&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	 &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;copyright&quot;&gt;
&lt;strong&gt;声明：&lt;/strong&gt;文章未声明为原创文章，本文链接 &lt;a href=&quot;http://js8.in/934.html&quot; title=&quot;javascript contains方法来判断元素包含关系&quot;&gt;http://js8.in/934.html&lt;/a&gt;. 转载请注明转自&lt;a href=&quot;http://js8.in&quot; title=&quot;前端开发博客&quot;&gt; JS8.IN ™&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;box-title&quot;&gt;随机文章&lt;/h3&gt;
&lt;ul class=&quot;box_random&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/272.html&quot; title=&quot;普通话考试！~&quot; rel=&quot;bookmark inlinks&quot;&gt;普通话考试！~&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/574.html&quot; title=&quot;只要20元，你也可以做个QQ爱墙&quot; rel=&quot;bookmark inlinks&quot;&gt;只要20元，你也可以做个QQ爱墙&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/670.html&quot; title=&quot;提高网站访问速度的十个技巧&quot; rel=&quot;bookmark inlinks&quot;&gt;提高网站访问速度的十个技巧&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/492.html&quot; title=&quot;十大Google Buzz的使用技巧&quot; rel=&quot;bookmark inlinks&quot;&gt;十大Google Buzz的使用技巧&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/35.html&quot; title=&quot;评论开通了~加上啦~&quot; rel=&quot;bookmark inlinks&quot;&gt;评论开通了~加上啦~&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/507.html&quot; title=&quot;25大实用的jQuery技巧和解决方案&quot; rel=&quot;bookmark inlinks&quot;&gt;25大实用的jQuery技巧和解决方案&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/509.html&quot; title=&quot;php获取来访者IP信息&quot; rel=&quot;bookmark inlinks&quot;&gt;php获取来访者IP信息&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/39.html&quot; title=&quot;08.11.17&quot; rel=&quot;bookmark inlinks&quot;&gt;08.11.17&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;small&gt;© 三水清 for &lt;a href=&quot;http://js8.in&quot;&gt;三水清&lt;/a&gt;, 2012. |
&lt;a href=&quot;http://js8.in/934.html#comments&quot;&gt;One comment&lt;/a&gt; |在微博关注我：&lt;a href=&quot;//weibo.com/sanshuiqing&quot; target=&quot;_blank&quot; title=&quot;关注断桥残雪的新浪微博&quot;&gt;@清-三水清&lt;/a&gt;
&lt;br/&gt;收藏到：
&lt;a rel=&quot;nofollow&quot; href=&quot;http://share.renren.com/share/buttonshare.do?link=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到人人网&quot; target=&quot;_blank&quot;&gt;人人网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.douban.com/recommend/?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到豆瓣&quot; target=&quot;_blank&quot;&gt;豆瓣&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&amp;rurl=%posturl%&quot; title=&quot;收藏本文到开心网&quot; target=&quot;_blank&quot;&gt;开心网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://shuqian.qq.com/post?title=%posttitle%&amp;%20uri=%posturl%&quot; title=&quot;收藏本文到QQ书签&quot; target=&quot;_blank&quot;&gt;QQ书签&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.sina.com.cn/share/share.php?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到新浪微博&quot; target=&quot;_blank&quot;&gt;新浪微博&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.qq.com/share/share.php?title=%posttitle%&amp;url=%posturl%&amp;site=http://www.kaixin100.info&quot; title=&quot;收藏本文到腾讯微博&quot; target=&quot;_blank&quot;&gt;腾讯微博&lt;/a&gt;
&lt;br/&gt;
Post tags: &lt;a href=&quot;http://js8.in/tag/contains&quot; rel=&quot;tag&quot;&gt;contains&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/javascript&quot; rel=&quot;tag&quot;&gt;javascript&lt;/a&gt;&lt;br/&gt;
&lt;/small&gt;&lt;/p&gt;&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;非字母javascript&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F918.html&amp;from=http%3A%2F%2Fjs8.in%2F934.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/30/11698517.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;非字母javascript&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Javascript事件触发列表与详解&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F480.html&amp;from=http%3A%2F%2Fjs8.in%2F934.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10982510.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Javascript事件触发列表与详解&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;JavaScript跨浏览器的添加删除事件绑定函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F408.html&amp;from=http%3A%2F%2Fjs8.in%2F934.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978769.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;JavaScript跨浏览器的添加删除事件绑定函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Javascript设置光标位置到结尾并显示出来&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F467.html&amp;from=http%3A%2F%2Fjs8.in%2F934.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11027176.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Javascript设置光标位置到结尾并显示出来&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762872/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762872/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://js8.in/934.html/feed</wfw:commentRss><slash:comments>1</slash:comments><description>IE中的contains方法可以判断A元素是否包含B元素，如果包含则返回true，否则返回false，在开发中会在事件代理处理上面用到。W3C的方法是compareDocumentPosition，所以综上来说：JS通过contains和compareDocumentPosition方法来确定DOM节点间的关系,判断一个元素(对象)是否为另一个元素的子元素。
IE的contains方法很简单，但是W3C的DOMElement.contains(DOMNode)方法会返回却是一个数值。
DOMElement.contains(DOMNode)
link：https://developer.mozilla.org/En/DOM/Node.compareDocumentPosition。
DOMElement.contains(DOMNode)返回的不是一个布尔值，而是一个很奇怪的数值，它是通过如下方式累加计算出来的：





      


Bits
Number
Meaning




000000
0
元素一致


000001
1
节点在不同的文档（或者一个在文档之外）


000010
2
节点 B 在节点 A 之前


000100
4
节点 A 在节点 B 之前 


001000
8
节点 B 包含节点 A


010000
16
节点 A 包含节点 B


100000 
32
浏览器的私有使用 




综上，来个@司徒正美 大大的方案：

var contains  = function&amp;#40;root, el&amp;#41; &amp;#123;
	 if &amp;#40;root.compareDocumentPosition&amp;#41;
		 return root === el &amp;#124;&amp;#124; !!&amp;#40;root.compareDocumentPosition&amp;#40;el&amp;#41; &amp;#38; 16&amp;#41;;
	 if &amp;#40;root.contains &amp;#38;&amp;#38; el.nodeType === 1&amp;#41;&amp;#123;
		 return root.contains&amp;#40;el&amp;#41; &amp;#38;&amp;#38; root !== el;
	 &amp;#125;
	 while [...]&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;非字母javascript&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F918.html&amp;from=http%3A%2F%2Fjs8.in%2F934.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/30/11698517.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;非字母javascript&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Javascript事件触发列表与详解&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F480.html&amp;from=http%3A%2F%2Fjs8.in%2F934.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10982510.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Javascript事件触发列表与详解&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;JavaScript跨浏览器的添加删除事件绑定函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F408.html&amp;from=http%3A%2F%2Fjs8.in%2F934.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978769.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;JavaScript跨浏览器的添加删除事件绑定函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Javascript设置光标位置到结尾并显示出来&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F467.html&amp;from=http%3A%2F%2Fjs8.in%2F934.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11027176.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Javascript设置光标位置到结尾并显示出来&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762872/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762872/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>javascript</category><category>JavaScript</category><category>contains</category><pubDate>Thu, 05 Jan 2012 09:49:20 +0800</pubDate><author>三水清</author><comments>http://js8.in/934.html#comments</comments><guid isPermaLink="false">http://js8.in/?p=934</guid><dc:creator>三水清</dc:creator><fs:srclink>http://js8.in/934.html</fs:srclink><fs:srcfeed>http://www.js8.in/feed</fs:srcfeed><fs:itemid>feedsky/r57c/~8361098/602762872/6028780</fs:itemid></item><item><title>使用webbench做压力测试</title><link>http://item.feedsky.com/~feedsky/r57c/~8361098/602762873/6028780/1/item.html</link><content:encoded>&lt;p&gt;元旦假期帮朋友折腾VPS，安装了centOS和lnmp，网站部好了，而且定时任务也加上了，觉得应该做个压力测试，之前用过apache自带的ab，不过今天使用的是&lt;strong&gt;webbench&lt;/strong&gt;做压力测试。备份下安装测试过程。&lt;br /&gt;
首先我们先来安装webbench吧, 为了测试准确，请将 webbench 安装在别的linux服务器上, 因为webbench 做压力测试时，自身也会消耗CPU和内存资源, 否则, 很可能把自己服务器搞挂掉。于是我切换到了ubuntu系统做&lt;strong&gt;webbench测试&lt;/strong&gt;。&lt;/p&gt;
&lt;h2&gt;安装webbench&lt;/h2&gt;
&lt;p&gt;安装过程比较简单，如果你的机子之前安装过一些常用软件直接使用下面的命令就可以了：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz&lt;br /&gt;
tar zxvf webbench-1.5.tar.gz&lt;br /&gt;
cd webbench-1.5&lt;br /&gt;
make &amp;#038;&amp;#038; make install&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2&gt;webbench安装报错&lt;/h2&gt;
&lt;h3&gt;没有安装ctags&lt;/h3&gt;
&lt;p&gt;如果没有安装 ctags make 编译会报错：&lt;code&gt;/bin/sh: ctags: command not found&lt;/code&gt;&lt;br /&gt;
这时当然是要安装ctags啦，于是：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;apt-get install ctags&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;搞定&lt;/p&gt;
&lt;h3&gt;没有安装gcc&lt;/h3&gt;
&lt;p&gt;这时候可能会报错：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;cc: Command not found&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;这时需要gcc：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;apt-get install gcc&lt;/p&gt;&lt;/blockquote&gt;
&lt;h3&gt;其他报错&lt;/h3&gt;
&lt;p&gt;如果出现下面的错误：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;cannot create regular file `/usr/local/man/man1&amp;#8242;: No such file or directory&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span id=&quot;more-930&quot;&gt;&lt;/span&gt;&lt;br /&gt;
这时需要创建&lt;code&gt;/usr/local/man/man1&lt;/code&gt;文件来解决：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;mkdir -m 644 -p /usr/local/man/man1&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2&gt;使用webbench做压力测试&lt;/h2&gt;
&lt;p&gt;经过上面的折腾，webbench终于安装好了，下面要做的就是做个&lt;strong&gt;压力测试&lt;/strong&gt;了，在shell里面输入下面的命令：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;webbench -c 500 -t 30 http://127.0.0.1/test.jpg&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;参数说明：-c表示并发数，-t表示时间(秒)&lt;/p&gt;
&lt;p&gt;最后就会出现详细的测试信息了：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Webbench &amp;#8211; Simple Web Benchmark 1.5&lt;br /&gt;
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.&lt;/p&gt;
&lt;p&gt;Benchmarking: GET http://127.0.0.1/test.jpg&lt;br /&gt;
500 clients, running 30 sec.&lt;/p&gt;
&lt;p&gt;Speed=3230 pages/min, 11614212 bytes/sec.&lt;br /&gt;
Requests: 1615 susceed, 0 failed.&lt;/p&gt;&lt;/blockquote&gt;
&lt;div class=&quot;copyright&quot;&gt;
&lt;strong&gt;声明：&lt;/strong&gt;文章未声明为原创文章，本文链接 &lt;a href=&quot;http://js8.in/930.html&quot; title=&quot;使用webbench做压力测试&quot;&gt;http://js8.in/930.html&lt;/a&gt;. 转载请注明转自&lt;a href=&quot;http://js8.in&quot; title=&quot;前端开发博客&quot;&gt; JS8.IN ™&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;box-title&quot;&gt;随机文章&lt;/h3&gt;
&lt;ul class=&quot;box_random&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/555.html&quot; title=&quot;Img,Script,Link等标签为空可导致页面多余请求&quot; rel=&quot;bookmark inlinks&quot;&gt;Img,Script,Link等标签为空可导致页面多余请求&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/750.html&quot; title=&quot;javascript入门到高级PPT&quot; rel=&quot;bookmark inlinks&quot;&gt;javascript入门到高级PPT&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/28.html&quot; title=&quot;08.11.16&quot; rel=&quot;bookmark inlinks&quot;&gt;08.11.16&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/533.html&quot; title=&quot;QQ概念版已经开放下载使用&quot; rel=&quot;bookmark inlinks&quot;&gt;QQ概念版已经开放下载使用&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/809.html&quot; title=&quot;javascript嵌套函数的效率问题&quot; rel=&quot;bookmark inlinks&quot;&gt;javascript嵌套函数的效率问题&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/283.html&quot; title=&quot;jQuery+google weather API轻松实现天气地图（二）&quot; rel=&quot;bookmark inlinks&quot;&gt;jQuery+google weather API轻松实现天气地图（二）&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/594.html&quot; title=&quot;JS的Image对象可用于检测图片类型是否合法&quot; rel=&quot;bookmark inlinks&quot;&gt;JS的Image对象可用于检测图片类型是否合法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/516.html&quot; title=&quot;js8.in PR值升为4&quot; rel=&quot;bookmark inlinks&quot;&gt;js8.in PR值升为4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;small&gt;© 三水清 for &lt;a href=&quot;http://js8.in&quot;&gt;三水清&lt;/a&gt;, 2012. |
&lt;a href=&quot;http://js8.in/930.html#comments&quot;&gt;No comment&lt;/a&gt; |在微博关注我：&lt;a href=&quot;//weibo.com/sanshuiqing&quot; target=&quot;_blank&quot; title=&quot;关注断桥残雪的新浪微博&quot;&gt;@清-三水清&lt;/a&gt;
&lt;br/&gt;收藏到：
&lt;a rel=&quot;nofollow&quot; href=&quot;http://share.renren.com/share/buttonshare.do?link=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到人人网&quot; target=&quot;_blank&quot;&gt;人人网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.douban.com/recommend/?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到豆瓣&quot; target=&quot;_blank&quot;&gt;豆瓣&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&amp;rurl=%posturl%&quot; title=&quot;收藏本文到开心网&quot; target=&quot;_blank&quot;&gt;开心网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://shuqian.qq.com/post?title=%posttitle%&amp;%20uri=%posturl%&quot; title=&quot;收藏本文到QQ书签&quot; target=&quot;_blank&quot;&gt;QQ书签&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.sina.com.cn/share/share.php?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到新浪微博&quot; target=&quot;_blank&quot;&gt;新浪微博&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.qq.com/share/share.php?title=%posttitle%&amp;url=%posturl%&amp;site=http://www.kaixin100.info&quot; title=&quot;收藏本文到腾讯微博&quot; target=&quot;_blank&quot;&gt;腾讯微博&lt;/a&gt;
&lt;br/&gt;
Post tags: &lt;a href=&quot;http://js8.in/tag/linux&quot; rel=&quot;tag&quot;&gt;linux&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/webbench&quot; rel=&quot;tag&quot;&gt;webbench&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/%e5%8e%8b%e5%8a%9b%e6%b5%8b%e8%af%95&quot; rel=&quot;tag&quot;&gt;压力测试&lt;/a&gt;&lt;br/&gt;
&lt;/small&gt;&lt;/p&gt;&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;linux安装PHP加速器eAccelerator&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F888.html&amp;from=http%3A%2F%2Fjs8.in%2F930.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/09/15/12184400.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;linux安装PHP加速器eAccelerator&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;使用windows7的virtual PC打造原装IE6、IE7、IE8测试环境&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F688.html&amp;from=http%3A%2F%2Fjs8.in%2F930.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978881.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;使用windows7的virtual PC打造原装IE6、IE7、IE8测试环境&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Ubuntu安装Samba实现跟windows文件共享&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F526.html&amp;from=http%3A%2F%2Fjs8.in%2F930.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979469.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Ubuntu安装Samba实现跟windows文件共享&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;jQuery1.4正式版新功能及性能测试&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F450.html&amp;from=http%3A%2F%2Fjs8.in%2F930.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11026546.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;jQuery1.4正式版新功能及性能测试&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762873/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762873/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://js8.in/930.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>元旦假期帮朋友折腾VPS，安装了centOS和lnmp，网站部好了，而且定时任务也加上了，觉得应该做个压力测试，之前用过apache自带的ab，不过今天使用的是webbench做压力测试。备份下安装测试过程。
首先我们先来安装webbench吧, 为了测试准确，请将 webbench 安装在别的linux服务器上, 因为webbench 做压力测试时，自身也会消耗CPU和内存资源, 否则, 很可能把自己服务器搞挂掉。于是我切换到了ubuntu系统做webbench测试。
安装webbench
安装过程比较简单，如果你的机子之前安装过一些常用软件直接使用下面的命令就可以了：
wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz
tar zxvf webbench-1.5.tar.gz
cd webbench-1.5
make &amp;#038;&amp;#038; make install
webbench安装报错
没有安装ctags
如果没有安装 ctags make 编译会报错：/bin/sh: ctags: command not found
这时当然是要安装ctags啦，于是：
apt-get install ctags
搞定
没有安装gcc
这时候可能会报错：
cc: Command not found
这时需要gcc：
apt-get install gcc
其他报错
如果出现下面的错误：
cannot create regular file `/usr/local/man/man1&amp;#8242;: No such file or directory

这时需要创建/usr/local/man/man1文件来解决：
mkdir -m 644 -p /usr/local/man/man1
使用webbench做压力测试
经过上面的折腾，webbench终于安装好了，下面要做的就是做个压力测试了，在shell里面输入下面的命令：
webbench -c 500 -t 30 http://127.0.0.1/test.jpg
参数说明：-c表示并发数，-t表示时间(秒)
最后就会出现详细的测试信息了：
Webbench &amp;#8211; Simple Web Benchmark 1.5
Copyright (c) Radim Kolar [...]&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;linux安装PHP加速器eAccelerator&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F888.html&amp;from=http%3A%2F%2Fjs8.in%2F930.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/09/15/12184400.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;linux安装PHP加速器eAccelerator&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;使用windows7的virtual PC打造原装IE6、IE7、IE8测试环境&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F688.html&amp;from=http%3A%2F%2Fjs8.in%2F930.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978881.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;使用windows7的virtual PC打造原装IE6、IE7、IE8测试环境&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Ubuntu安装Samba实现跟windows文件共享&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F526.html&amp;from=http%3A%2F%2Fjs8.in%2F930.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979469.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Ubuntu安装Samba实现跟windows文件共享&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;jQuery1.4正式版新功能及性能测试&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F450.html&amp;from=http%3A%2F%2Fjs8.in%2F930.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11026546.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;jQuery1.4正式版新功能及性能测试&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762873/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762873/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>linux</category><category>webbench</category><category>压力测试</category><category>网络技术</category><pubDate>Wed, 04 Jan 2012 15:37:38 +0800</pubDate><author>三水清</author><comments>http://js8.in/930.html#comments</comments><guid isPermaLink="false">http://js8.in/?p=930</guid><dc:creator>三水清</dc:creator><fs:srclink>http://js8.in/930.html</fs:srclink><fs:srcfeed>http://www.js8.in/feed</fs:srcfeed><fs:itemid>feedsky/r57c/~8361098/602762873/6028780</fs:itemid></item><item><title>非字母javascript</title><link>http://item.feedsky.com/~feedsky/r57c/~8361098/602762874/6028780/1/item.html</link><content:encoded>&lt;p&gt;你尝试过写javascript不用字母和数字吗？最近准备个xss的分享，记起了之前看到过老外一篇文章，内容是关于non-alpha javascript的，拿到代码分析下。&lt;br /&gt;
先看这段猥琐的javascript代码：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;_&lt;span style=&quot;color: #339933;&quot;&gt;=+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;_&lt;span style=&quot;color: #339933;&quot;&gt;++;&lt;/span&gt;__&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;_&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;___&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;_&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;_&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;____&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;__&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;__&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;_____&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;__&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;___&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;$$&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_____&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;___&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;__&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_____&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;$$$&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;__&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;___&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;$_$&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_____&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;__&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;__&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;_____&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_____&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;_&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;__&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;___&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;$$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;$$&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;$$$&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;('&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;$_$&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;')&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;看到这里你肯定抓狂了，但是这段代码是可以运行的，运行的结果是 &lt;code&gt;alert('cool code');&lt;/code&gt; 。&lt;/p&gt;
&lt;h2&gt;javascript分析&lt;/h2&gt;
&lt;p&gt;这段代码能够运行，原因是javascript是弱类型的脚本语言，而且语法相对松散。例如下面的javascript是正确的，而且是有出乎意料结果的：&lt;br /&gt;
&lt;span id=&quot;more-918&quot;&gt;&lt;/span&gt;&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//2&lt;/span&gt;
undefined&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;''&lt;/span&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//'undefined'&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//'t'&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;''&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//true&lt;/span&gt;
&lt;span style=&quot;color: #3366CC;&quot;&gt;''&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//true&lt;/span&gt;
&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;typeof&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;''&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//number,0&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;''&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//&amp;quot;[object Object]&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//undefined&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;所以我们想得到一个0就可以使用:&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;_&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
_&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;''&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;下一步通过&lt;a href=&quot;http://js8.in/906.html&quot; title=&quot;javascript 位运算符&quot; target=&quot;_blank&quot;&gt;位运算&lt;/a&gt;，++等运算可以得到0~9所有数字。&lt;/p&gt;
&lt;p&gt;因为0就是false，则!0就是true，&lt;code&gt;({}[0]);&lt;/code&gt;可以得到undefined，&lt;code&gt;({}+'')&lt;/code&gt;可以得到字符串：[object Object]，字符串中的字符，可以组成新的字符串，于是通过组合，我们就得到了：&lt;code&gt;&quot;constructor&quot;&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;javascript中的点(.)运算符和[]的作用都是一样的，只不过[]可以接收传入变量、字符串，所以我们可以得到一个Function对象，即：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;'constructor'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;'constructor'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;另外我们也知道，下面的代码是运行的：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #3366CC;&quot;&gt;'alert(1);'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;所以，我想剩下的你就懂了……
&lt;div class=&quot;copyright&quot;&gt;
&lt;strong&gt;声明：&lt;/strong&gt;文章未声明为原创文章，本文链接 &lt;a href=&quot;http://js8.in/918.html&quot; title=&quot;非字母javascript&quot;&gt;http://js8.in/918.html&lt;/a&gt;. 转载请注明转自&lt;a href=&quot;http://js8.in&quot; title=&quot;前端开发博客&quot;&gt; JS8.IN ™&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;box-title&quot;&gt;随机文章&lt;/h3&gt;
&lt;ul class=&quot;box_random&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/554.html&quot; title=&quot;引入CSS 的两种方式：link和@import的区别&quot; rel=&quot;bookmark inlinks&quot;&gt;引入CSS 的两种方式：link和@import的区别&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/618.html&quot; title=&quot;使用PHP把excel(xls)文件导入mysql数据库&quot; rel=&quot;bookmark inlinks&quot;&gt;使用PHP把excel(xls)文件导入mysql数据库&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/455.html&quot; title=&quot;谷歌退出中国事件尘埃落定&quot; rel=&quot;bookmark inlinks&quot;&gt;谷歌退出中国事件尘埃落定&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/495.html&quot; title=&quot;爱墙 许愿墙 祝福墙程序免费下载&quot; rel=&quot;bookmark inlinks&quot;&gt;爱墙 许愿墙 祝福墙程序免费下载&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/580.html&quot; title=&quot;爱墙（许愿墙）程序后台添加置顶、搜索等功能&quot; rel=&quot;bookmark inlinks&quot;&gt;爱墙（许愿墙）程序后台添加置顶、搜索等功能&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/667.html&quot; title=&quot;修改获取验证码图片到本地的PHP程序&quot; rel=&quot;bookmark inlinks&quot;&gt;修改获取验证码图片到本地的PHP程序&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/15.html&quot; title=&quot;奋斗了两天！&quot; rel=&quot;bookmark inlinks&quot;&gt;奋斗了两天！&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/40.html&quot; title=&quot;影视剧中就那点剧情！&quot; rel=&quot;bookmark inlinks&quot;&gt;影视剧中就那点剧情！&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;small&gt;© 三水清 for &lt;a href=&quot;http://js8.in&quot;&gt;三水清&lt;/a&gt;, 2011. |
&lt;a href=&quot;http://js8.in/918.html#comments&quot;&gt;5 comments&lt;/a&gt; |在微博关注我：&lt;a href=&quot;//weibo.com/sanshuiqing&quot; target=&quot;_blank&quot; title=&quot;关注断桥残雪的新浪微博&quot;&gt;@清-三水清&lt;/a&gt;
&lt;br/&gt;收藏到：
&lt;a rel=&quot;nofollow&quot; href=&quot;http://share.renren.com/share/buttonshare.do?link=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到人人网&quot; target=&quot;_blank&quot;&gt;人人网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.douban.com/recommend/?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到豆瓣&quot; target=&quot;_blank&quot;&gt;豆瓣&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&amp;rurl=%posturl%&quot; title=&quot;收藏本文到开心网&quot; target=&quot;_blank&quot;&gt;开心网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://shuqian.qq.com/post?title=%posttitle%&amp;%20uri=%posturl%&quot; title=&quot;收藏本文到QQ书签&quot; target=&quot;_blank&quot;&gt;QQ书签&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.sina.com.cn/share/share.php?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到新浪微博&quot; target=&quot;_blank&quot;&gt;新浪微博&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.qq.com/share/share.php?title=%posttitle%&amp;url=%posturl%&amp;site=http://www.kaixin100.info&quot; title=&quot;收藏本文到腾讯微博&quot; target=&quot;_blank&quot;&gt;腾讯微博&lt;/a&gt;
&lt;br/&gt;
Post tags: &lt;a href=&quot;http://js8.in/tag/javascript&quot; rel=&quot;tag&quot;&gt;javascript&lt;/a&gt;&lt;br/&gt;
&lt;/small&gt;&lt;/p&gt;&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;javascript获取光标位置以及设置光标位置&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F466.html&amp;from=http%3A%2F%2Fjs8.in%2F918.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979320.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;javascript获取光标位置以及设置光标位置&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Javascript正则表达式详解&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F473.html&amp;from=http%3A%2F%2Fjs8.in%2F918.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2012/02/06/14873015.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Javascript正则表达式详解&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Javascript事件触发列表与详解&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F480.html&amp;from=http%3A%2F%2Fjs8.in%2F918.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10982510.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Javascript事件触发列表与详解&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;JavaScript跨浏览器的添加删除事件绑定函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F408.html&amp;from=http%3A%2F%2Fjs8.in%2F918.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978769.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;JavaScript跨浏览器的添加删除事件绑定函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762874/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762874/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://js8.in/918.html/feed</wfw:commentRss><slash:comments>5</slash:comments><description>你尝试过写javascript不用字母和数字吗？最近准备个xss的分享，记起了之前看到过老外一篇文章，内容是关于non-alpha javascript的，拿到代码分析下。
先看这段猥琐的javascript代码：

_=+&amp;#91;&amp;#93;;$=_++;__=&amp;#40;_&amp;#60;&amp;#60;_&amp;#41;;___=&amp;#40;_&amp;#60;&amp;#60;_&amp;#41;+_;____=__+__;_____=__+___;$$=&amp;#40;&amp;#123;&amp;#125;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_____&amp;#93;+&amp;#40;&amp;#123;&amp;#125;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_&amp;#93;+&amp;#40;&amp;#123;&amp;#125;&amp;#91;$&amp;#93;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_&amp;#93;+&amp;#40;&amp;#40;$!=$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;___&amp;#93;+&amp;#40;&amp;#40;$==$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;$&amp;#93;+&amp;#40;&amp;#40;$==$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_&amp;#93;+&amp;#40;&amp;#40;$==$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;__&amp;#93;+&amp;#40;&amp;#123;&amp;#125;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_____&amp;#93;+&amp;#40;&amp;#40;$==$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;$&amp;#93;+&amp;#40;&amp;#123;&amp;#125;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_&amp;#93;+&amp;#40;&amp;#40;$==$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_&amp;#93;;$$$=&amp;#40;&amp;#40;$!=$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_&amp;#93;+&amp;#40;&amp;#40;$!=$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;__&amp;#93;+&amp;#40;&amp;#40;$==$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;___&amp;#93;+&amp;#40;&amp;#40;$==$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_&amp;#93;+&amp;#40;&amp;#40;$==$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;$&amp;#93;;$_$=&amp;#40;&amp;#123;&amp;#125;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_____&amp;#93;+&amp;#40;&amp;#123;&amp;#125;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_&amp;#93;+&amp;#40;&amp;#123;&amp;#125;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_&amp;#93;+&amp;#40;&amp;#40;$!=$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;__&amp;#93;+&amp;#40;&amp;#123;&amp;#125;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;__+_____&amp;#93;+&amp;#40;&amp;#123;&amp;#125;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_____&amp;#93;+ &amp;#40;&amp;#123;&amp;#125;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;_&amp;#93;+&amp;#40;&amp;#123;&amp;#125;&amp;#91;$&amp;#93;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;__&amp;#93;+&amp;#40;&amp;#40;$==$&amp;#41;+&amp;#34;&amp;#34;&amp;#41;&amp;#91;___&amp;#93;; &amp;#40;$&amp;#41;&amp;#91;$$&amp;#93;&amp;#91;$$&amp;#93;&amp;#40;$$$+&amp;#34;('&amp;#34;+$_$+&amp;#34;')&amp;#34;&amp;#41;&amp;#40;&amp;#41;;

看到这里你肯定抓狂了，但是这段代码是可以运行的，运行的结果是 alert('cool code'); 。
javascript分析
这段代码能够运行，原因是javascript是弱类型的脚本语言，而且语法相对松散。例如下面的javascript是正确的，而且是有出乎意料结果的：


true+true;//2
undefined+''//'undefined'
&amp;#40;true+&amp;#34;&amp;#34;&amp;#41;&amp;#91;0&amp;#93;;//'t'
&amp;#91;&amp;#93;=='';//true
''==0;//true
typeof &amp;#40;+''&amp;#41;;//number,0
&amp;#40;&amp;#123;&amp;#125;+''&amp;#41;;//&amp;#34;[object Object]&amp;#34;
&amp;#40;&amp;#123;&amp;#125;&amp;#91;0&amp;#93;&amp;#41;;//undefined

所以我们想得到一个0就可以使用:

_= +&amp;#91;&amp;#93;;
_= +'';

下一步通过位运算，++等运算可以得到0~9所有数字。
因为0就是false，则!0就是true，({}[0]);可以得到undefined，({}+'')可以得到字符串：[object Object]，字符串中的字符，可以组成新的字符串，于是通过组合，我们就得到了：&quot;constructor&quot;。
javascript中的点(.)运算符和[]的作用都是一样的，只不过[]可以接收传入变量、字符串，所以我们可以得到一个Function对象，即：

&amp;#40;0&amp;#41;&amp;#91;'constructor'&amp;#93;&amp;#91;'constructor'&amp;#93;;

另外我们也知道，下面的代码是运行的：

Function&amp;#40;'alert(1);'&amp;#41;&amp;#40;&amp;#41;;

所以，我想剩下的你就懂了……

声明：文章未声明为原创文章，本文链接 http://js8.in/918.html. 转载请注明转自 JS8.IN ™
随机文章

切换订阅地址到feedsky
IE中flash遮挡div现象的解决方案
最新版wBox 解决IE6 背景太小bug
javascript的String.replace的妙用
开博两年了：换了主题 改了名
影视剧中就那点剧情！
查看自己是否在对方QQ好友中最简单的方法
爱墙（许愿墙）程序后台添加置顶、搜索等功能


© 三水清 for 三水清, 2011. &amp;#124;
5 comments &amp;#124;在微博关注我：@清-三水清
收藏到：
人人网 &amp;#124; 豆瓣 &amp;#124; 开心网 &amp;#124; QQ书签 &amp;#124; 新浪微博 &amp;#124; 腾讯微博

Post tags: javascript
&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;javascript获取光标位置以及设置光标位置&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F466.html&amp;from=http%3A%2F%2Fjs8.in%2F918.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979320.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;javascript获取光标位置以及设置光标位置&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Javascript正则表达式详解&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F473.html&amp;from=http%3A%2F%2Fjs8.in%2F918.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2012/02/06/14873015.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Javascript正则表达式详解&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Javascript事件触发列表与详解&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F480.html&amp;from=http%3A%2F%2Fjs8.in%2F918.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10982510.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Javascript事件触发列表与详解&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;JavaScript跨浏览器的添加删除事件绑定函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F408.html&amp;from=http%3A%2F%2Fjs8.in%2F918.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978769.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;JavaScript跨浏览器的添加删除事件绑定函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762874/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762874/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>javascript</category><category>JavaScript</category><pubDate>Wed, 30 Nov 2011 10:17:03 +0800</pubDate><author>三水清</author><comments>http://js8.in/918.html#comments</comments><guid isPermaLink="false">http://js8.in/?p=918</guid><dc:creator>三水清</dc:creator><fs:srclink>http://js8.in/918.html</fs:srclink><fs:srcfeed>http://www.js8.in/feed</fs:srcfeed><fs:itemid>feedsky/r57c/~8361098/602762874/6028780</fs:itemid></item><item><title>javascript 位运算符</title><link>http://item.feedsky.com/~feedsky/r57c/~8361098/602762875/6028780/1/item.html</link><content:encoded>&lt;p&gt;前几天看到国外人在github总结的&lt;strong&gt;javascript&lt;/strong&gt;的奇巧淫技（http://t.cn/herRcq），里面对位运算提到的很多，所以来科普一下javascript的位运算。于是找到了w3cschool的这篇教程，很好很强大啊，于是就忍不住转载了……&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ECMAScript&lt;/strong&gt; 整数有两种类型，即有符号整数（允许用正数和负数）和无符号整数（只允许用正数）。在 ECMAScript 中，所有整数字面量默认都是有符号整数，这意味着什么呢？&lt;/p&gt;
&lt;p&gt;有符号整数使用 31 位表示整数的数值，用第 32 位表示整数的符号，0 表示正数，1 表示负数。数值范围从 -2147483648 到 2147483647。&lt;/p&gt;
&lt;p&gt;可以以两种不同的方式存储二进制形式的有符号整数，一种用于存储正数，一种用于存储负数。正数是以真二进制形式存储的，前 31 位中的每一位都表示 2 的幂，从第 1 位（位 0）开始，表示 2&lt;sup&gt;0&lt;/sup&gt;，第 2 位（位 1）表示 2&lt;sup&gt;1&lt;/sup&gt;。没用到的位用 0 填充，即忽略不计。例如，下图展示的是数 18 的表示法。&lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;border-style: initial; border-color: initial; margin-top: 25px; margin-right: 0px; margin-bottom: 0px; ;&quot; src=&quot;http://www.w3school.com.cn/i/ct_js_integer_binary_signed_32bits.gif&quot; alt=&quot;32 位二进制表示的有符号整数&quot; /&gt;&lt;/p&gt;
&lt;p&gt;18 的二进制版本只用了前 5 位，它们是这个数字的有效位。把数字转换成二进制字符串，就能看到有效位：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iNum &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;18&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000066;&quot;&gt;alert&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;iNum.&lt;span style=&quot;color: #660066;&quot;&gt;toString&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;	&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//输出 &amp;quot;10010&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这段代码只输出 &amp;#8220;10010&amp;#8243;，而不是 18 的 32 位表示。其他的数位并不重要，因为仅使用前 5 位即可确定这个十进制数值。如下图所示：&lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;border-style: initial; border-color: initial; margin-top: 25px; margin-right: 0px; margin-bottom: 0px; ;&quot; src=&quot;http://www.w3school.com.cn/i/ct_js_integer_binary_number18.gif&quot; alt=&quot;5 位二进制表示的整数 18&quot; /&gt;&lt;/p&gt;
&lt;p&gt;负数也存储为二进制代码，不过采用的形式是二进制补码。计算数字二进制补码的步骤有三步：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;确定该数字的非负版本的二进制表示（例如，要计算 -18的二进制补码，首先要确定 18 的二进制表示）&lt;/li&gt;
&lt;li&gt;求得二进制反码，即要把 0 替换为 1，把 1 替换为 0&lt;/li&gt;
&lt;li&gt;在二进制反码上加 1&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;要确定 -18 的二进制表示，首先必须得到 18 的二进制表示，如下所示：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;0000 0000 0000 0000 0000 0000 0001 0010&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;接下来，计算二进制反码，如下所示：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1110&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1101&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后，在二进制反码上加 1，如下所示：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1110&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1101&lt;/span&gt;
                                      &lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;
&lt;span style=&quot;color: #339933;&quot;&gt;---------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1111&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1110&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;1110&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;因此，-18 的二进制表示即 1111 1111 1111 1111 1111 1111 1110 1110。记住，在处理有符号整数时，开发者不能访问 31 位。&lt;/p&gt;
&lt;p&gt;有趣的是，把负整数转换成二进制字符串后，ECMAScript 并不以二进制补码的形式显示，而是用数字绝对值的标准二进制代码前面加负号的形式输出。例如：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iNum &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;18&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000066;&quot;&gt;alert&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;iNum.&lt;span style=&quot;color: #660066;&quot;&gt;toString&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;	&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//输出 &amp;quot;-10010&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这段代码输出的是 &amp;#8220;-10010&amp;#8243;，而非二进制补码，这是为避免访问位 31。为了简便，ECMAScript 用一种简单的方式处理整数，使得开发者不必关心它们的用法。&lt;/p&gt;
&lt;p&gt;另一方面，无符号整数把最后一位作为另一个数位处理。在这种模式中，第 32 位不表示数字的符号，而是值 2&lt;sup&gt;31&lt;/sup&gt;。由于这个额外的位，无符号整数的数值范围为 0 到 4294967295。对于小于 2147483647 的整数来说，无符号整数看来与有符号整数一样，而大于 2147483647 的整数则要使用位 31（在有符号整数中，这一位总是 0）。&lt;/p&gt;
&lt;p&gt;把无符号整数转换成字符串后，只返回它们的有效位。&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-weight: bold; color: #dd0000;&quot;&gt;注意：&lt;/span&gt;所有整数字面量都默认存储为有符号整数。只有 ECMAScript 的位运算符才能创建无符号整数。&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-906&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2 &gt;位运算 NOT&lt;/h2&gt;
&lt;p&gt;位运算 NOT 由否定号（~）表示，它是 ECMAScript 中为数不多的与二进制算术有关的运算符之一。&lt;/p&gt;
&lt;p&gt;位运算 NOT 是三步的处理过程：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;把运算数转换成 32 位数字&lt;/li&gt;
&lt;li&gt;把二进制数转换成它的二进制反码&lt;/li&gt;
&lt;li&gt;把二进制数转换成浮点数&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;例如：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iNum1 &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;25&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;		&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//25 等于 00000000000000000000000000011001&lt;/span&gt;
&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iNum2 &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; ~iNum1&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;	&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//转换为 11111111111111111111111111100110&lt;/span&gt;
&lt;span style=&quot;color: #000066;&quot;&gt;alert&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;iNum2&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;		&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//输出 &amp;quot;-26&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;位运算 NOT 实质上是对数字求负，然后减 1，因此 25 变 -26。用下面的方法也可以得到同样的方法：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iNum1 &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;25&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iNum2 &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;iNum1 &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000066;&quot;&gt;alert&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;iNum2&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;	&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//输出 -26&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2&gt;位运算 AND&lt;/h2&gt;
&lt;p&gt;位运算 AND 由和号（&amp;amp;）表示，直接对数字的二进制形式进行运算。它把每个数字中的数位对齐，然后用下面的规则对同一位置上的两个数位进行 AND 运算：&lt;/p&gt;
&lt;table style=&quot;font-family: Arial, Helvetica, sans-serif; margin-top: 10px; border-collapse: collapse;border: 1px solid #888888;&quot; border=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th style=&quot;vertical-align: baseline; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #cccccc; text-align: left; border: 1px solid #888888;&quot;&gt;第一个数字中的数位&lt;/th&gt;
&lt;th style=&quot;vertical-align: baseline; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #cccccc; text-align: left; border: 1px solid #888888;&quot;&gt;第二个数字中的数位&lt;/th&gt;
&lt;th style=&quot;vertical-align: baseline; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #cccccc; text-align: left; border: 1px solid #888888;&quot;&gt;结果&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;例如，要对数字 25 和 3 进行 AND 运算，代码如下所示：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iResult &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;25&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000066;&quot;&gt;alert&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;iResult&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;	&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//输出 &amp;quot;1&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;25 和 3 进行 AND 运算的结果是 1。为什么？分析如下：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;25&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; 0000 0000 0000 0000 0000 0000 0001 &lt;span style=&quot;color: #CC0000;&quot;&gt;1001&lt;/span&gt;
  &lt;span style=&quot;color: #CC0000;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; 0000 0000 0000 0000 0000 0000 0000 0011
&lt;span style=&quot;color: #339933;&quot;&gt;---------------------------------------------&lt;/span&gt;
AND &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; 0000 0000 0000 0000 0000 0000 0000 0001&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看出，在 25 和 3 中，只有一个数位（位 0）存放的都是 1，因此，其他数位生成的都是 0，所以结果为 1。&lt;/p&gt;
&lt;h2 &gt;位运算 OR&lt;/h2&gt;
&lt;p&gt;位运算 OR 由符号（|）表示，也是直接对数字的二进制形式进行运算。在计算每位时，OR 运算符采用下列规则：&lt;/p&gt;
&lt;table style=&quot;font-family: Arial, Helvetica, sans-serif; margin-top: 10px; border-collapse: collapse;border: 1px solid #888888;&quot; border=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th style=&quot;vertical-align: baseline; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #cccccc; text-align: left; border: 1px solid #888888;&quot;&gt;第一个数字中的数位&lt;/th&gt;
&lt;th style=&quot;vertical-align: baseline; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #cccccc; text-align: left; border: 1px solid #888888;&quot;&gt;第二个数字中的数位&lt;/th&gt;
&lt;th style=&quot;vertical-align: baseline; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #cccccc; text-align: left; border: 1px solid #888888;&quot;&gt;结果&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;仍然使用 AND 运算符所用的例子，对 25 和 3 进行 OR 运算，代码如下：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iResult &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;25&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000066;&quot;&gt;alert&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;iResult&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;	&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//输出 &amp;quot;27&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;25 和 3 进行 OR 运算的结果是 27：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;25&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; 0000 0000 0000 0000 0000 0000 0001 &lt;span style=&quot;color: #CC0000;&quot;&gt;1001&lt;/span&gt;
 &lt;span style=&quot;color: #CC0000;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; 0000 0000 0000 0000 0000 0000 0000 0011
&lt;span style=&quot;color: #339933;&quot;&gt;--------------------------------------------&lt;/span&gt;
OR &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; 0000 0000 0000 0000 0000 0000 0001 &lt;span style=&quot;color: #CC0000;&quot;&gt;1011&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看出，在两个数字中，共有 4 个数位存放的是 1，这些数位被传递给结果。二进制代码 11011 等于 27。&lt;/p&gt;
&lt;h2 &gt;位运算 XOR&lt;/h2&gt;
&lt;p&gt;位运算 XOR 由符号（^）表示，当然，也是直接对二进制形式进行运算。XOR 不同于 OR，当只有一个数位存放的是 1 时，它才返回 1。真值表如下：&lt;/p&gt;
&lt;table style=&quot;font-family: Arial, Helvetica, sans-serif; margin-top: 10px; border-collapse: collapse;border: 1px solid #888888;&quot; border=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th style=&quot;vertical-align: baseline; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #cccccc; text-align: left; border: 1px solid #888888;&quot;&gt;第一个数字中的数位&lt;/th&gt;
&lt;th style=&quot;vertical-align: baseline; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #cccccc; text-align: left; border: 1px solid #888888;&quot;&gt;第二个数字中的数位&lt;/th&gt;
&lt;th style=&quot;vertical-align: baseline; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #cccccc; text-align: left; border: 1px solid #888888;&quot;&gt;结果&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;td style=&quot;vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: #efefef; border: 1px solid #aaaaaa;&quot;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;对 25 和 3 进行 XOR 运算，代码如下：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iResult &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;25&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;^&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000066;&quot;&gt;alert&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;iResult&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;	&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//输出 &amp;quot;26&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;25 和 3 进行 XOR 运算的结果是 26：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;25&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; 0000 0000 0000 0000 0000 0000 0001 &lt;span style=&quot;color: #CC0000;&quot;&gt;1001&lt;/span&gt;
  &lt;span style=&quot;color: #CC0000;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; 0000 0000 0000 0000 0000 0000 0000 0011
&lt;span style=&quot;color: #339933;&quot;&gt;---------------------------------------------&lt;/span&gt;
XOR &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; 0000 0000 0000 0000 0000 0000 0001 &lt;span style=&quot;color: #CC0000;&quot;&gt;1010&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;可以看出，在两个数字中，共有 4 个数位存放的是 1，这些数位被传递给结果。二进制代码 11010 等于 26。&lt;/p&gt;
&lt;h2 &gt;左移运算&lt;/h2&gt;
&lt;p&gt;左移运算由两个小于号表示（&lt;&lt;）。它把数字中的所有数位向左移动指定的数量。例如，把数字 2（等于二进制中的 10）左移 5 位，结果为 64（等于二进制中的 1000000）：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iOld &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;		&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//等于二进制 10&lt;/span&gt;
&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iNew &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; iOld &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;	&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//等于二进制 1000000 十进制 64&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;span style=&quot;font-weight: bold; color: #dd0000;&quot;&gt;注意：&lt;/span&gt;在左移数位时，数字右边多出 5 个空位。左移运算用 0 填充这些空位，使结果成为完整的 32 位数字。&lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;border-style: initial; border-color: initial; margin-top: 25px; margin-right: 0px; margin-bottom: 0px; ;&quot; src=&quot;http://www.w3school.com.cn/i/ct_js_operators_bitwise_leftshift.gif&quot; alt=&quot;数字 2 进行左移运算&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-weight: bold; color: #dd0000;&quot;&gt;注意：&lt;/span&gt;左移运算保留数字的符号位。例如，如果把 -2 左移 5 位，得到的是 -64，而不是 64。“符号仍然存储在第 32 位中吗？”是的，不过这在 ECMAScript 后台进行，开发者不能直接访问第 32 个数位。即使输出二进制字符串形式的负数，显示的也是负号形式（例如，-2 将显示 -10。）&lt;/p&gt;
&lt;h2 &gt;有符号右移运算&lt;/h2&gt;
&lt;p&gt;有符号右移运算符由两个大于号表示（&amp;lt;$lt;）。它把 32 位数字中的所有数位整体右移，同时保留该数的符号（正号或负号）。有符号右移运算符恰好与左移运算相反。例如，把 64 右移 5 位，将变为 2：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iOld &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;64&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;		&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//等于二进制 1000000&lt;/span&gt;
&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iNew &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; iOld &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;	&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//等于二进制 10 十进制 2&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;同样，移动数位后会造成空位。这次，空位位于数字的左侧，但位于符号位之后。ECMAScript 用符号位的值填充这些空位，创建完整的数字，如下图所示：&lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;border-style: initial; border-color: initial; margin-top: 25px; margin-right: 0px; margin-bottom: 0px; ;&quot; src=&quot;http://www.w3school.com.cn/i/ct_js_operators_bitwise_signedrightshift.gif&quot; alt=&quot;数字 64 进行有符号右移运算&quot; /&gt;&lt;/p&gt;
&lt;h2 &gt;无符号右移运算&lt;/h2&gt;
&lt;p&gt;无符号右移运算符由三个大于号（&gt;&gt;&amp;gt;）表示，它将无符号 32 位数的所有数位整体右移。对于正数，无符号右移运算的结果与有符号右移运算一样。&lt;/p&gt;
&lt;p&gt;用有符号右移运算中的例子，把 64 右移 5 位，将变为 2：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iOld &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;64&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;		&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//等于二进制 1000000&lt;/span&gt;
&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iNew &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; iOld &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;	&lt;span style=&quot;color: #006600; font-style: italic;&quot;&gt;//等于二进制 10 十进制 2&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;对于负数，情况就不同了。&lt;/p&gt;
&lt;p&gt;无符号右移运算用 0 填充所有空位。对于正数，这与有符号右移运算的操作一样，而负数则被作为正数来处理。&lt;/p&gt;
&lt;p&gt;由于无符号右移运算的结果是一个 32 位的正数，所以负数的无符号右移运算得到的总是一个非常大的数字。例如，如果把 -64 右移 5 位，将得到 134217726。如果得到这种结果的呢？&lt;/p&gt;
&lt;p&gt;要实现这一点，需要把这个数字转换成无符号的等价形式（尽管该数字本身还是有符号的），可以通过以下代码获得这种形式：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iUnsigned64 &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;64&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #CC0000;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后，用 Number 类型的 toString() 获取它的真正的位表示，采用的基为 2：&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;javascript&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;alert&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;iUnsigned64.&lt;span style=&quot;color: #660066;&quot;&gt;toString&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #CC0000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这将生成 11111111111111111111111111000000，即有符号整数 -64 的二进制补码表示，不过它等于无符号整数 4294967232。&lt;/p&gt;
&lt;p&gt;出于这种原因，使用无符号右移运算符要小心。&lt;/p&gt;
&lt;p&gt;原文地址：http://www.w3school.com.cn/js/pro_js_operators_bitwise.asp
&lt;div class=&quot;copyright&quot;&gt;
&lt;strong&gt;声明：&lt;/strong&gt;文章未声明为原创文章，本文链接 &lt;a href=&quot;http://js8.in/906.html&quot; title=&quot;javascript 位运算符&quot;&gt;http://js8.in/906.html&lt;/a&gt;. 转载请注明转自&lt;a href=&quot;http://js8.in&quot; title=&quot;前端开发博客&quot;&gt; JS8.IN ™&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;box-title&quot;&gt;随机文章&lt;/h3&gt;
&lt;ul class=&quot;box_random&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/706.html&quot; title=&quot;IE6中a标签location.href失效解决方法&quot; rel=&quot;bookmark inlinks&quot;&gt;IE6中a标签location.href失效解决方法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/481.html&quot; title=&quot;瑞星贿赂造假丑闻曝光，为转移视线捏造360后门事件&quot; rel=&quot;bookmark inlinks&quot;&gt;瑞星贿赂造假丑闻曝光，为转移视线捏造360后门事件&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/607.html&quot; title=&quot;提高Firefox的innerHTML()的性能&quot; rel=&quot;bookmark inlinks&quot;&gt;提高Firefox的innerHTML()的性能&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/491.html&quot; title=&quot;雷：蓝翔技校黑谷歌！&quot; rel=&quot;bookmark inlinks&quot;&gt;雷：蓝翔技校黑谷歌！&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/561.html&quot; title=&quot;推荐一款支持win7的超酷3D水纹屏保-Watery Desktop&quot; rel=&quot;bookmark inlinks&quot;&gt;推荐一款支持win7的超酷3D水纹屏保-Watery Desktop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/72.html&quot; title=&quot;发布一个仿QQSvr的dedecms模板&quot; rel=&quot;bookmark inlinks&quot;&gt;发布一个仿QQSvr的dedecms模板&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/338.html&quot; title=&quot;最新的DreamHost优惠码免费发放&quot; rel=&quot;bookmark inlinks&quot;&gt;最新的DreamHost优惠码免费发放&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/352.html&quot; title=&quot;wordpress Follow5插件发布&quot; rel=&quot;bookmark inlinks&quot;&gt;wordpress Follow5插件发布&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;small&gt;© 三水清 for &lt;a href=&quot;http://js8.in&quot;&gt;三水清&lt;/a&gt;, 2011. |
&lt;a href=&quot;http://js8.in/906.html#comments&quot;&gt;One comment&lt;/a&gt; |在微博关注我：&lt;a href=&quot;//weibo.com/sanshuiqing&quot; target=&quot;_blank&quot; title=&quot;关注断桥残雪的新浪微博&quot;&gt;@清-三水清&lt;/a&gt;
&lt;br/&gt;收藏到：
&lt;a rel=&quot;nofollow&quot; href=&quot;http://share.renren.com/share/buttonshare.do?link=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到人人网&quot; target=&quot;_blank&quot;&gt;人人网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.douban.com/recommend/?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到豆瓣&quot; target=&quot;_blank&quot;&gt;豆瓣&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&amp;rurl=%posturl%&quot; title=&quot;收藏本文到开心网&quot; target=&quot;_blank&quot;&gt;开心网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://shuqian.qq.com/post?title=%posttitle%&amp;%20uri=%posturl%&quot; title=&quot;收藏本文到QQ书签&quot; target=&quot;_blank&quot;&gt;QQ书签&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.sina.com.cn/share/share.php?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到新浪微博&quot; target=&quot;_blank&quot;&gt;新浪微博&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.qq.com/share/share.php?title=%posttitle%&amp;url=%posturl%&amp;site=http://www.kaixin100.info&quot; title=&quot;收藏本文到腾讯微博&quot; target=&quot;_blank&quot;&gt;腾讯微博&lt;/a&gt;
&lt;br/&gt;
Post tags: &lt;a href=&quot;http://js8.in/tag/javascript&quot; rel=&quot;tag&quot;&gt;javascript&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/%e4%bd%8d%e8%bf%90%e7%ae%97&quot; rel=&quot;tag&quot;&gt;位运算&lt;/a&gt;&lt;br/&gt;
&lt;/small&gt;&lt;/p&gt;&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;通过javascript实现整站黑白效果&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F529.html&amp;from=http%3A%2F%2Fjs8.in%2F906.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/10979192.gif&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;通过javascript实现整站黑白效果&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;javascript获取光标位置以及设置光标位置&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F466.html&amp;from=http%3A%2F%2Fjs8.in%2F906.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979320.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;javascript获取光标位置以及设置光标位置&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Javascript事件触发列表与详解&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F480.html&amp;from=http%3A%2F%2Fjs8.in%2F906.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10982510.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Javascript事件触发列表与详解&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;JavaScript跨浏览器的添加删除事件绑定函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F408.html&amp;from=http%3A%2F%2Fjs8.in%2F906.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978769.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;JavaScript跨浏览器的添加删除事件绑定函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762875/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762875/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://js8.in/906.html/feed</wfw:commentRss><slash:comments>1</slash:comments><description>前几天看到国外人在github总结的javascript的奇巧淫技（http://t.cn/herRcq），里面对位运算提到的很多，所以来科普一下javascript的位运算。于是找到了w3cschool的这篇教程，很好很强大啊，于是就忍不住转载了……
ECMAScript 整数有两种类型，即有符号整数（允许用正数和负数）和无符号整数（只允许用正数）。在 ECMAScript 中，所有整数字面量默认都是有符号整数，这意味着什么呢？
有符号整数使用 31 位表示整数的数值，用第 32 位表示整数的符号，0 表示正数，1 表示负数。数值范围从 -2147483648 到 2147483647。
可以以两种不同的方式存储二进制形式的有符号整数，一种用于存储正数，一种用于存储负数。正数是以真二进制形式存储的，前 31 位中的每一位都表示 2 的幂，从第 1 位（位 0）开始，表示 20，第 2 位（位 1）表示 21。没用到的位用 0 填充，即忽略不计。例如，下图展示的是数 18 的表示法。

18 的二进制版本只用了前 5 位，它们是这个数字的有效位。把数字转换成二进制字符串，就能看到有效位：

var iNum = 18;
alert&amp;#40;iNum.toString&amp;#40;2&amp;#41;&amp;#41;;	//输出 &amp;#34;10010&amp;#34;

这段代码只输出 &amp;#8220;10010&amp;#8243;，而不是 18 的 32 位表示。其他的数位并不重要，因为仅使用前 5 位即可确定这个十进制数值。如下图所示：

负数也存储为二进制代码，不过采用的形式是二进制补码。计算数字二进制补码的步骤有三步：

确定该数字的非负版本的二进制表示（例如，要计算 -18的二进制补码，首先要确定 18 的二进制表示）
求得二进制反码，即要把 0 替换为 1，把 1 替换为 0
在二进制反码上加 1

要确定 -18 的二进制表示，首先必须得到 [...]&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;通过javascript实现整站黑白效果&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F529.html&amp;from=http%3A%2F%2Fjs8.in%2F906.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/10979192.gif&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;通过javascript实现整站黑白效果&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;javascript获取光标位置以及设置光标位置&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F466.html&amp;from=http%3A%2F%2Fjs8.in%2F906.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979320.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;javascript获取光标位置以及设置光标位置&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;Javascript事件触发列表与详解&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F480.html&amp;from=http%3A%2F%2Fjs8.in%2F906.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10982510.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;Javascript事件触发列表与详解&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;JavaScript跨浏览器的添加删除事件绑定函数&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F408.html&amp;from=http%3A%2F%2Fjs8.in%2F906.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10978769.bmp&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;JavaScript跨浏览器的添加删除事件绑定函数&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762875/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762875/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>位运算</category><category>javascript</category><category>JavaScript</category><pubDate>Tue, 29 Nov 2011 10:46:09 +0800</pubDate><author>三水清</author><comments>http://js8.in/906.html#comments</comments><guid isPermaLink="false">http://js8.in/?p=906</guid><dc:creator>三水清</dc:creator><fs:srclink>http://js8.in/906.html</fs:srclink><fs:srcfeed>http://www.js8.in/feed</fs:srcfeed><fs:itemid>feedsky/r57c/~8361098/602762875/6028780</fs:itemid></item><item><title>IE6中javascript文件开启Gzip出现代码不执行情况</title><link>http://item.feedsky.com/~feedsky/r57c/~8361098/602762876/6028780/1/item.html</link><content:encoded>&lt;p&gt;今天处理IE6下的一个bug，经过调试才发现是&lt;strong&gt;javascript&lt;/strong&gt;文件文件总是执行不了，后来中午吃完饭回来才想起以前同事遇见的html中的javascript不可以执行的问题，怀疑是gzip的原因，此次的问题就是因为动态加载javascript文件导致代码不执行，经过研究发现gzip压缩过的javascript文件，如果header里Cache-Control 数据有no-cache, no-store，就会出现IE6中js代码不执行的问题。下面是转发的文章内容：&lt;/p&gt;
&lt;p&gt;IE6下面调用开启了gzip压缩Javascript的时候，时常会碰到无法执行的情况，有可能是src调用，有可能是ajax调用，其它的浏览器工作正常，唯独IE6不能正常工作。&lt;br /&gt;
出现这个BUG的状况如下：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;用户使用IE6浏览器&lt;/li&gt;
&lt;li&gt;服务器没有设置 被请求文件(javascript) expires, cache-control.&lt;/li&gt;
&lt;li&gt;服务器端开启了chunked encoding模式&lt;/li&gt;
&lt;li&gt;通过javascrip的src调用方式或者ajax请求javascript文件&lt;/li&gt;
&lt;li&gt;有可能是通过php生成的javascript文件&lt;/li&gt;
&lt;li&gt;服务器端开启了gzip压缩&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;解决这个问题，我们要在服务器的cache-control和expires 头信息上做点工作。&lt;br /&gt;
经过测试，header头信息如下的gzip压缩过的javascript调用可以正常工作。&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Cache-Control:maxage=1&lt;br /&gt;
Connection:keep-alive&lt;br /&gt;
Content-Encoding:gzip&lt;br /&gt;
Content-Type:application/x-javascript;charset=GBK&lt;br /&gt;
Date:Wed, 01 Dec 2010 01:24:07 GMT&lt;br /&gt;
Expires:Wed, 01 Dec 2010 01:24:08 GMT&lt;br /&gt;
Pragma:public&lt;br /&gt;
Server:nginx&lt;br /&gt;
Transfer-Encoding:chunked&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;分析上面的头信息，我们可以注意到：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;cache-control必须要设置成maxage=time的格式，maxage是指定缓存生效时间，1为1秒&lt;/li&gt;
&lt;li&gt;Expires必须要设置，它的时间稍大于Date即可，Date是页面请求时间，Expires是过期时间&lt;/li&gt;
&lt;li&gt;Pragma设置为public&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span id=&quot;more-902&quot;&gt;&lt;/span&gt;&lt;br /&gt;
设置好了这两个参数，一般就可以了。&lt;/p&gt;
&lt;p&gt;在nginx服务器端，我们需要对服务器配置：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;location ~* \.(ico|css|js|png|jpeg|jpg|gif|rar|zip|7z|gz|pdf) {&lt;br /&gt;
expires 1d;&lt;br /&gt;
}&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;如果javascript文件是由PHP生成的，我们就需要利用php来输出header控制了。&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;php&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span style=&quot;color: #000088;&quot;&gt;$expires&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;Pragma: public&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;Cache-Control: maxage=&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$expires&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'Expires: '&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;gmdate&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'D, d M Y H:i:s'&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;time&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$expires&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;' GMT'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;header&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;Content-Type: application/x-javascript;charset=GBK&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;实际应用中，需要灵活配置，Javascript文件，请尽可能通过服务器发送header头，PHP生成javascript文件，效率本来就不高，再加上额外需要输入header头，更是得不偿失。
&lt;div class=&quot;copyright&quot;&gt;
&lt;strong&gt;声明：&lt;/strong&gt;文章未声明为原创文章，本文链接 &lt;a href=&quot;http://js8.in/902.html&quot; title=&quot;IE6中javascript文件开启Gzip出现代码不执行情况&quot;&gt;http://js8.in/902.html&lt;/a&gt;. 转载请注明转自&lt;a href=&quot;http://js8.in&quot; title=&quot;前端开发博客&quot;&gt; JS8.IN ™&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;box-title&quot;&gt;随机文章&lt;/h3&gt;
&lt;ul class=&quot;box_random&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/236.html&quot; title=&quot;淘宝秒杀门事件始末&quot; rel=&quot;bookmark inlinks&quot;&gt;淘宝秒杀门事件始末&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/491.html&quot; title=&quot;雷：蓝翔技校黑谷歌！&quot; rel=&quot;bookmark inlinks&quot;&gt;雷：蓝翔技校黑谷歌！&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/533.html&quot; title=&quot;QQ概念版已经开放下载使用&quot; rel=&quot;bookmark inlinks&quot;&gt;QQ概念版已经开放下载使用&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/605.html&quot; title=&quot;javascript简单实现checkbox的全选与反选&quot; rel=&quot;bookmark inlinks&quot;&gt;javascript简单实现checkbox的全选与反选&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/481.html&quot; title=&quot;瑞星贿赂造假丑闻曝光，为转移视线捏造360后门事件&quot; rel=&quot;bookmark inlinks&quot;&gt;瑞星贿赂造假丑闻曝光，为转移视线捏造360后门事件&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/52.html&quot; title=&quot;万众期待的Ajax评论发布啦-dedecms扩展工具&quot; rel=&quot;bookmark inlinks&quot;&gt;万众期待的Ajax评论发布啦-dedecms扩展工具&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/642.html&quot; title=&quot;使用mysqldump、into outfile和load data进行数据库导入导出备份&quot; rel=&quot;bookmark inlinks&quot;&gt;使用mysqldump、into outfile和load data进行数据库导入导出备份&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/471.html&quot; title=&quot;简单修改.htaccess来提高Yslow等级&quot; rel=&quot;bookmark inlinks&quot;&gt;简单修改.htaccess来提高Yslow等级&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;small&gt;© 三水清 for &lt;a href=&quot;http://js8.in&quot;&gt;三水清&lt;/a&gt;, 2011. |
&lt;a href=&quot;http://js8.in/902.html#comments&quot;&gt;8 comments&lt;/a&gt; |在微博关注我：&lt;a href=&quot;//weibo.com/sanshuiqing&quot; target=&quot;_blank&quot; title=&quot;关注断桥残雪的新浪微博&quot;&gt;@清-三水清&lt;/a&gt;
&lt;br/&gt;收藏到：
&lt;a rel=&quot;nofollow&quot; href=&quot;http://share.renren.com/share/buttonshare.do?link=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到人人网&quot; target=&quot;_blank&quot;&gt;人人网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.douban.com/recommend/?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到豆瓣&quot; target=&quot;_blank&quot;&gt;豆瓣&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&amp;rurl=%posturl%&quot; title=&quot;收藏本文到开心网&quot; target=&quot;_blank&quot;&gt;开心网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://shuqian.qq.com/post?title=%posttitle%&amp;%20uri=%posturl%&quot; title=&quot;收藏本文到QQ书签&quot; target=&quot;_blank&quot;&gt;QQ书签&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.sina.com.cn/share/share.php?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到新浪微博&quot; target=&quot;_blank&quot;&gt;新浪微博&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.qq.com/share/share.php?title=%posttitle%&amp;url=%posturl%&amp;site=http://www.kaixin100.info&quot; title=&quot;收藏本文到腾讯微博&quot; target=&quot;_blank&quot;&gt;腾讯微博&lt;/a&gt;
&lt;br/&gt;
Post tags: &lt;a href=&quot;http://js8.in/tag/bug&quot; rel=&quot;tag&quot;&gt;bug&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/ie6&quot; rel=&quot;tag&quot;&gt;IE6&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/javascript&quot; rel=&quot;tag&quot;&gt;javascript&lt;/a&gt;&lt;br/&gt;
&lt;/small&gt;&lt;/p&gt;&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6中a标签location.href失效解决方法&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&amp;from=http%3A%2F%2Fjs8.in%2F902.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/07/21/18318778.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6中a标签location.href失效解决方法&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6 PNG图片不透明问题的解决方法&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F380.html&amp;from=http%3A%2F%2Fjs8.in%2F902.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/09/01/2770440.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6 PNG图片不透明问题的解决方法&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6下javascript不能隐藏select标签的bug&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&amp;from=http%3A%2F%2Fjs8.in%2F902.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10987937.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6下javascript不能隐藏select标签的bug&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6中a标签触发图片和ajax请求被abort&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&amp;from=http%3A%2F%2Fjs8.in%2F902.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2012/02/04/14747078.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6中a标签触发图片和ajax请求被abort&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762876/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762876/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://js8.in/902.html/feed</wfw:commentRss><slash:comments>8</slash:comments><description>今天处理IE6下的一个bug，经过调试才发现是javascript文件文件总是执行不了，后来中午吃完饭回来才想起以前同事遇见的html中的javascript不可以执行的问题，怀疑是gzip的原因，此次的问题就是因为动态加载javascript文件导致代码不执行，经过研究发现gzip压缩过的javascript文件，如果header里Cache-Control 数据有no-cache, no-store，就会出现IE6中js代码不执行的问题。下面是转发的文章内容：
IE6下面调用开启了gzip压缩Javascript的时候，时常会碰到无法执行的情况，有可能是src调用，有可能是ajax调用，其它的浏览器工作正常，唯独IE6不能正常工作。
出现这个BUG的状况如下：

用户使用IE6浏览器
服务器没有设置 被请求文件(javascript) expires, cache-control.
服务器端开启了chunked encoding模式
通过javascrip的src调用方式或者ajax请求javascript文件
有可能是通过php生成的javascript文件
服务器端开启了gzip压缩

解决这个问题，我们要在服务器的cache-control和expires 头信息上做点工作。
经过测试，header头信息如下的gzip压缩过的javascript调用可以正常工作。
Cache-Control:maxage=1
Connection:keep-alive
Content-Encoding:gzip
Content-Type:application/x-javascript;charset=GBK
Date:Wed, 01 Dec 2010 01:24:07 GMT
Expires:Wed, 01 Dec 2010 01:24:08 GMT
Pragma:public
Server:nginx
Transfer-Encoding:chunked
分析上面的头信息，我们可以注意到：

cache-control必须要设置成maxage=time的格式，maxage是指定缓存生效时间，1为1秒
Expires必须要设置，它的时间稍大于Date即可，Date是页面请求时间，Expires是过期时间
Pragma设置为public


设置好了这两个参数，一般就可以了。
在nginx服务器端，我们需要对服务器配置：
location ~* \.(ico&amp;#124;css&amp;#124;js&amp;#124;png&amp;#124;jpeg&amp;#124;jpg&amp;#124;gif&amp;#124;rar&amp;#124;zip&amp;#124;7z&amp;#124;gz&amp;#124;pdf) {
expires 1d;
}
如果javascript文件是由PHP生成的，我们就需要利用php来输出header控制了。

&amp;#60;?php
$expires = 1;
header&amp;#40;&amp;#34;Pragma: public&amp;#34;&amp;#41;;
header&amp;#40;&amp;#34;Cache-Control: maxage=&amp;#34;.$expires&amp;#41;;
header&amp;#40;'Expires: ' . gmdate&amp;#40;'D, d M Y H:i:s', time&amp;#40;&amp;#41;+$expires&amp;#41; . ' GMT'&amp;#41;;
header&amp;#40;&amp;#34;Content-Type: application/x-javascript;charset=GBK\n&amp;#34;&amp;#41;;

实际应用中，需要灵活配置，Javascript文件，请尽可能通过服务器发送header头，PHP生成javascript文件，效率本来就不高，再加上额外需要输入header头，更是得不偿失。

声明：文章未声明为原创文章，本文链接 http://js8.in/902.html. 转载请注明转自 JS8.IN ™
随机文章

jQuery插件wBox准备更新
最新的DreamHost优惠码免费发放
企业黄页网站GongSiHuangYe.COM上线
GoDaddy促销COM域名，在华仅0.99美元
IE的fireEvent方法
使用ZeroClipboard解决跨浏览器复制到剪贴板的问题
切换订阅地址到feedsky
javascript作用域和作用域链


© 三水清 for 三水清, 2011. &amp;#124;
8 comments &amp;#124;在微博关注我：@清-三水清
收藏到：
人人网 &amp;#124; 豆瓣 &amp;#124; 开心网 &amp;#124; QQ书签 [...]&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6中a标签location.href失效解决方法&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F706.html&amp;from=http%3A%2F%2Fjs8.in%2F902.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/07/21/18318778.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6中a标签location.href失效解决方法&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6 PNG图片不透明问题的解决方法&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F380.html&amp;from=http%3A%2F%2Fjs8.in%2F902.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/09/01/2770440.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6 PNG图片不透明问题的解决方法&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6下javascript不能隐藏select标签的bug&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F686.html&amp;from=http%3A%2F%2Fjs8.in%2F902.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10987937.png&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6下javascript不能隐藏select标签的bug&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;IE6中a标签触发图片和ajax请求被abort&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F944.html&amp;from=http%3A%2F%2Fjs8.in%2F902.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2012/02/04/14747078.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;IE6中a标签触发图片和ajax请求被abort&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762876/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762876/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>IE6</category><category>php</category><category>网络技术</category><category>bug</category><category>javascript</category><pubDate>Tue, 15 Nov 2011 20:25:23 +0800</pubDate><author>三水清</author><comments>http://js8.in/902.html#comments</comments><guid isPermaLink="false">http://js8.in/?p=902</guid><dc:creator>三水清</dc:creator><fs:srclink>http://js8.in/902.html</fs:srclink><fs:srcfeed>http://www.js8.in/feed</fs:srcfeed><fs:itemid>feedsky/r57c/~8361098/602762876/6028780</fs:itemid></item><item><title>开博两年了：换了主题 改了名</title><link>http://item.feedsky.com/~feedsky/r57c/~8361098/602762877/6028780/1/item.html</link><content:encoded>&lt;p&gt;js8.in这个域名已经快两年历史了，自己开博客也要有三年历史了吧，可以追溯到大学时候的日志，最早的域名是2fool.cn，可是09年的备案风波，我不得不换了js8.in，当时还是&lt;a target=&quot;_blank&quot; href=&quot;http://oncoding.cn&quot; title=&quot;幼学笔记&quot; target=&quot;_blank&quot;&gt;啊花童鞋&lt;/a&gt;帮忙起的，主机一直是蹭了他的godaddy主机。昨天去朝阳见了袁童鞋，感觉自己的差距越来越大了，他这半年研究了两个超级牛逼的东西：smarthome和手机当鼠标用的东东，自叹不如。回了家，思前想后，越来越惭愧。普加最近来北京的越来越多，小马哥打电话说：舍不得以前的团队，大家散了，可惜了。的确很想你们，虽然现在可以很容易的见面，可是就像万童鞋说的，来了北京发现少了那种归属感和责任感，现在的工作完全是合同关系。&lt;/p&gt;
&lt;p&gt;本来想说博客的事情，却突然发了这么多的感慨。博客正式两年是2012年的1月22，也就是大年三十，那时候肯定没时间发博客，趁着现在有时间，又换了主题一段时间了，就总结下。&lt;/p&gt;
&lt;h3&gt;三水清博客的发展&lt;/h3&gt;
&lt;p&gt;本博客从最最开始记录大学的一些事情，到发展成为&lt;strong&gt;前端开发博客&lt;/strong&gt;经历了不少“大事情”，期间换域名2fool.cn 更换问js8.in，顺便名字从二傻网，改为了断桥残雪部落格，之前徐同事经常戏称“残花败柳”，其实断桥残雪是西湖的十大美景之一，有点凄凉的感觉，后来啊花说自己一个朋友也是这个名字，所以一直相机会换下名字，为了找工作，注册了微博（其实之前是有的，因为参加APP大赛当了官方微博用了，后来被封了），并且起名字为“清-三水清”，三水清其实是我名字，因为某机关的优秀同志，把我的清换成了青，所以为了强调自己的清是清水的清，一直会说“是三点水的清的那个清”。&lt;/p&gt;
&lt;h3&gt;微博的主题&lt;/h3&gt;
&lt;p&gt;上个月博客换了主题，也就是现在的主题，顺便连博客的名字也就改了。感谢老纪同学百忙中听我唠叨，帮我设计博客主题，听说他快当爹了，提前祝福下老纪和嫂子。&lt;br /&gt;
&lt;span id=&quot;more-900&quot;&gt;&lt;/span&gt;&lt;br /&gt;
这次的博客主题跟上一个版本的一样是html5+css3的，对IE6也没做兼容，风格很像新版新浪微博，而且换肤直接读取的新浪微博的皮肤css即可，换肤后默认记录皮肤cookie。&lt;/p&gt;
&lt;h3&gt;域名更短&lt;/h3&gt;
&lt;p&gt;自从换了主题之后，排名收录都不错，于是果断把网址从www.js8.in，301跳转到了js8.in，更加简洁。经过一段时间来看，百度google的排名还是不错的。所以以后大家进入我的boke就可以少敲4个字符了，直接输入&lt;strong&gt;js8.in&lt;/strong&gt;回车就可以了。&lt;/p&gt;
&lt;p&gt;网址的站点统计使用的是量子统计，因为他的代码简单，我将代码copy到本地，修改了一下，只看个访客内容就可以了，没太多的要求，近期来看，每天的IP稳定在700以上，只是周末有点少（可能因为周末程序猿都休息吧），订阅本前端博客的已经超过了300，还是不错的一个数据。&lt;/p&gt;
&lt;p&gt;今天看了司徒正美的文章比较有感觉，从面试到工资再讲到了前端工程师的个人发展，发现自己还要继续努力，前端的路子很长，说实话有时候前端做的事情很杂，也不受重视，但是前端却至关重要。浮躁了自己，则会被后来者追上，静下心来看清自己，看清自己的发展才是正道。以后会继续写前端的文章，大家多来捧场，记得我博客的名字：三水清，网址：js8.in.&lt;/p&gt;
&lt;p&gt;ps:从小不会写作文，每次写的乱七八糟，自嘲到——意识流风格。&lt;/p&gt;
&lt;div class=&quot;copyright&quot;&gt;
&lt;strong&gt;声明：&lt;/strong&gt;文章未声明为原创文章，本文链接 &lt;a href=&quot;http://js8.in/900.html&quot; title=&quot;开博两年了：换了主题 改了名&quot;&gt;http://js8.in/900.html&lt;/a&gt;. 转载请注明转自&lt;a href=&quot;http://js8.in&quot; title=&quot;前端开发博客&quot;&gt; JS8.IN ™&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 class=&quot;box-title&quot;&gt;随机文章&lt;/h3&gt;
&lt;ul class=&quot;box_random&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/507.html&quot; title=&quot;25大实用的jQuery技巧和解决方案&quot; rel=&quot;bookmark inlinks&quot;&gt;25大实用的jQuery技巧和解决方案&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/951.html&quot; title=&quot;【PPT分享】XSS注入和防范&quot; rel=&quot;bookmark inlinks&quot;&gt;【PPT分享】XSS注入和防范&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/440.html&quot; title=&quot;谷歌500元免费AdWords广告费申请第二步&quot; rel=&quot;bookmark inlinks&quot;&gt;谷歌500元免费AdWords广告费申请第二步&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/333.html&quot; title=&quot;在普加工作的十个要求&quot; rel=&quot;bookmark inlinks&quot;&gt;在普加工作的十个要求&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/585.html&quot; title=&quot;jQuery弹出框wBox的一个使用实例&quot; rel=&quot;bookmark inlinks&quot;&gt;jQuery弹出框wBox的一个使用实例&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/630.html&quot; title=&quot;我开发的新浪微博应用：微博送祝福&quot; rel=&quot;bookmark inlinks&quot;&gt;我开发的新浪微博应用：微博送祝福&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/638.html&quot; title=&quot;再谈Iframe的问题&quot; rel=&quot;bookmark inlinks&quot;&gt;再谈Iframe的问题&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://js8.in/620.html&quot; title=&quot;关于wBox iFrame回调关闭问题的解决方案&quot; rel=&quot;bookmark inlinks&quot;&gt;关于wBox iFrame回调关闭问题的解决方案&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p style=&quot;margin:0;padding:0;height:1px;overflow:hidden;&quot;&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
        var wumiiSitePrefix = &quot;http://js8.in&quot;;
        var wumiiEnableCustomPos = false;
        var wumiiParams = &quot;&amp;#038;num=4&amp;#038;mode=3&amp;#038;displayInFeed=1&amp;#038;version=1.0.5.5&amp;#038;pf=WordPress2.8.6&quot;;
    //--&gt;&lt;/script&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;small&gt;© 三水清 for &lt;a href=&quot;http://js8.in&quot;&gt;三水清&lt;/a&gt;, 2011. |
&lt;a href=&quot;http://js8.in/900.html#comments&quot;&gt;9 comments&lt;/a&gt; |在微博关注我：&lt;a href=&quot;//weibo.com/sanshuiqing&quot; target=&quot;_blank&quot; title=&quot;关注断桥残雪的新浪微博&quot;&gt;@清-三水清&lt;/a&gt;
&lt;br/&gt;收藏到：
&lt;a rel=&quot;nofollow&quot; href=&quot;http://share.renren.com/share/buttonshare.do?link=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到人人网&quot; target=&quot;_blank&quot;&gt;人人网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.douban.com/recommend/?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到豆瓣&quot; target=&quot;_blank&quot;&gt;豆瓣&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.kaixin001.com/repaste/share.php?rtitle=%posttitle%&amp;rurl=%posturl%&quot; title=&quot;收藏本文到开心网&quot; target=&quot;_blank&quot;&gt;开心网&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://shuqian.qq.com/post?title=%posttitle%&amp;%20uri=%posturl%&quot; title=&quot;收藏本文到QQ书签&quot; target=&quot;_blank&quot;&gt;QQ书签&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.sina.com.cn/share/share.php?url=%posturl%&amp;title=%posttitle%&quot; title=&quot;收藏本文到新浪微博&quot; target=&quot;_blank&quot;&gt;新浪微博&lt;/a&gt; | &lt;a rel=&quot;nofollow&quot; href=&quot;http://v.t.qq.com/share/share.php?title=%posttitle%&amp;url=%posturl%&amp;site=http://www.kaixin100.info&quot; title=&quot;收藏本文到腾讯微博&quot; target=&quot;_blank&quot;&gt;腾讯微博&lt;/a&gt;
&lt;br/&gt;
Post tags: &lt;a href=&quot;http://js8.in/tag/%e5%9f%9f%e5%90%8d&quot; rel=&quot;tag&quot;&gt;域名&lt;/a&gt;, &lt;a href=&quot;http://js8.in/tag/%e7%bd%91%e7%ab%99%e6%9b%b4%e6%96%b0&quot; rel=&quot;tag&quot;&gt;网站更新&lt;/a&gt;&lt;br/&gt;
&lt;/small&gt;&lt;/p&gt;&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;2fool.cn域名健在，爱墙升级&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F468.html&amp;from=http%3A%2F%2Fjs8.in%2F900.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979313.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;2fool.cn域名健在，爱墙升级&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;断桥残雪部落格更换新域名JS8.in&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F461.html&amp;from=http%3A%2F%2Fjs8.in%2F900.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979232.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;断桥残雪部落格更换新域名JS8.in&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;GoDaddy促销COM域名，在华仅0.99美元&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F383.html&amp;from=http%3A%2F%2Fjs8.in%2F900.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2010/12/22/1492610.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;GoDaddy促销COM域名，在华仅0.99美元&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;断桥残雪爱墙系统上线&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F60.html&amp;from=http%3A%2F%2Fjs8.in%2F900.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11026002.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;断桥残雪爱墙系统上线&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762877/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762877/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://js8.in/900.html/feed</wfw:commentRss><slash:comments>9</slash:comments><description>js8.in这个域名已经快两年历史了，自己开博客也要有三年历史了吧，可以追溯到大学时候的日志，最早的域名是2fool.cn，可是09年的备案风波，我不得不换了js8.in，当时还是啊花童鞋帮忙起的，主机一直是蹭了他的godaddy主机。昨天去朝阳见了袁童鞋，感觉自己的差距越来越大了，他这半年研究了两个超级牛逼的东西：smarthome和手机当鼠标用的东东，自叹不如。回了家，思前想后，越来越惭愧。普加最近来北京的越来越多，小马哥打电话说：舍不得以前的团队，大家散了，可惜了。的确很想你们，虽然现在可以很容易的见面，可是就像万童鞋说的，来了北京发现少了那种归属感和责任感，现在的工作完全是合同关系。
本来想说博客的事情，却突然发了这么多的感慨。博客正式两年是2012年的1月22，也就是大年三十，那时候肯定没时间发博客，趁着现在有时间，又换了主题一段时间了，就总结下。
三水清博客的发展
本博客从最最开始记录大学的一些事情，到发展成为前端开发博客经历了不少“大事情”，期间换域名2fool.cn 更换问js8.in，顺便名字从二傻网，改为了断桥残雪部落格，之前徐同事经常戏称“残花败柳”，其实断桥残雪是西湖的十大美景之一，有点凄凉的感觉，后来啊花说自己一个朋友也是这个名字，所以一直相机会换下名字，为了找工作，注册了微博（其实之前是有的，因为参加APP大赛当了官方微博用了，后来被封了），并且起名字为“清-三水清”，三水清其实是我名字，因为某机关的优秀同志，把我的清换成了青，所以为了强调自己的清是清水的清，一直会说“是三点水的清的那个清”。
微博的主题
上个月博客换了主题，也就是现在的主题，顺便连博客的名字也就改了。感谢老纪同学百忙中听我唠叨，帮我设计博客主题，听说他快当爹了，提前祝福下老纪和嫂子。

这次的博客主题跟上一个版本的一样是html5+css3的，对IE6也没做兼容，风格很像新版新浪微博，而且换肤直接读取的新浪微博的皮肤css即可，换肤后默认记录皮肤cookie。
域名更短
自从换了主题之后，排名收录都不错，于是果断把网址从www.js8.in，301跳转到了js8.in，更加简洁。经过一段时间来看，百度google的排名还是不错的。所以以后大家进入我的boke就可以少敲4个字符了，直接输入js8.in回车就可以了。
网址的站点统计使用的是量子统计，因为他的代码简单，我将代码copy到本地，修改了一下，只看个访客内容就可以了，没太多的要求，近期来看，每天的IP稳定在700以上，只是周末有点少（可能因为周末程序猿都休息吧），订阅本前端博客的已经超过了300，还是不错的一个数据。
今天看了司徒正美的文章比较有感觉，从面试到工资再讲到了前端工程师的个人发展，发现自己还要继续努力，前端的路子很长，说实话有时候前端做的事情很杂，也不受重视，但是前端却至关重要。浮躁了自己，则会被后来者追上，静下心来看清自己，看清自己的发展才是正道。以后会继续写前端的文章，大家多来捧场，记得我博客的名字：三水清，网址：js8.in.
ps:从小不会写作文，每次写的乱七八糟，自嘲到——意识流风格。

声明：文章未声明为原创文章，本文链接 http://js8.in/900.html. 转载请注明转自 JS8.IN ™
随机文章

利用浏览器书签实现的网页划词翻译工具
最新版wBox 解决IE6 背景太小bug
使用cygwin在windows下安装nodeJS
IE onchange事件触发bug？
jQuery插件wBox准备更新
自己写的DeDeCMS v5.3三级菜单
CSS3 Media Queries使用方法详解
推荐一款免费圣诞节新年WordPress主题


    

© 三水清 for 三水清, 2011. &amp;#124;
9 comments &amp;#124;在微博关注我：@清-三水清
收藏到：
人人网 &amp;#124; 豆瓣 &amp;#124; 开心网 &amp;#124; QQ书签 &amp;#124; 新浪微博 &amp;#124; 腾讯微博

Post tags: 域名, 网站更新
&lt;table class=&quot;wumii-related-items&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;  style=&quot;clear: both;&quot;&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot;&gt;&lt;b&gt;&lt;font size=&quot;-1&quot;  style=&quot;display: block !important; padding: 20px 0 5px !important;&quot;&gt;猜你喜欢：&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
        &lt;tr&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;2fool.cn域名健在，爱墙升级&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F468.html&amp;from=http%3A%2F%2Fjs8.in%2F900.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979313.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;2fool.cn域名健在，爱墙升级&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;断桥残雪部落格更换新域名JS8.in&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F461.html&amp;from=http%3A%2F%2Fjs8.in%2F900.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/17/10979232.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;断桥残雪部落格更换新域名JS8.in&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;GoDaddy促销COM域名，在华仅0.99美元&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F383.html&amp;from=http%3A%2F%2Fjs8.in%2F900.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2010/12/22/1492610.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;GoDaddy促销COM域名，在华仅0.99美元&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
                &lt;td width=&quot;102&quot; valign=&quot;top&quot; style=&quot;padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;&quot;&gt;
                    &lt;a target=&quot;_blank&quot; title=&quot;断桥残雪爱墙系统上线&quot; style=&quot;text-decoration: none !important; cursor: pointer !important;&quot; href=&quot;http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fjs8.in%2F60.html&amp;from=http%3A%2F%2Fjs8.in%2F900.html&quot;&gt;
                        &lt;img style=&quot;margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;&quot; src=&quot;http://static.wumii.com/site_images/2011/11/18/11026002.jpg&quot; width=&quot;96px&quot; height=&quot;96px&quot; /&gt;&lt;br /&gt;
                        &lt;font size=&quot;-1&quot; color=&quot;#333333&quot; style=&quot;display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;&quot;&gt;断桥残雪爱墙系统上线&lt;/font&gt;
                    &lt;/a&gt;
                &lt;/td&gt;
        &lt;/tr&gt;
    
    &lt;tr&gt;
        &lt;td colspan=&quot;4&quot; align=&quot;right&quot;&gt;
            &lt;a style=&quot;text-decoration: none !important;&quot; href=&quot;http://www.wumii.com/widget/relatedItems.htm&quot; target=&quot;_blank&quot; title=&quot;无觅相关文章插件&quot;&gt;
                &lt;font size=&quot;-1&quot; color=&quot;#bbbbbb&quot; style=&quot;display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;&quot;&gt;无觅&lt;/font&gt;
            &lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/602762877/r57c/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/r57c/~8361098/602762877/6028780/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>网站更新</category><category>心情日志</category><category>域名</category><pubDate>Sun, 13 Nov 2011 20:42:10 +0800</pubDate><author>三水清</author><comments>http://js8.in/900.html#comments</comments><guid isPermaLink="false">http://js8.in/?p=900</guid><dc:creator>三水清</dc:creator><fs:srclink>http://js8.in/900.html</fs:srclink><fs:srcfeed>http://www.js8.in/feed</fs:srcfeed><fs:itemid>feedsky/r57c/~8361098/602762877/6028780</fs:itemid></item></channel></rss>
