<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>I&#039;m qiqiboy ! &#187; 评论</title>
	<atom:link href="http://www.qiqiboy.com/tags/%e8%af%84%e8%ae%ba/feed" rel="self" type="application/rss+xml" />
	<link>http://www.qiqiboy.com</link>
	<description>一个very朝气的小孩子...</description>
	<lastBuildDate>Wed, 18 Jan 2012 03:32:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现</title>
		<link>http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html</link>
		<comments>http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html#comments</comments>
		<pubDate>Wed, 13 Jul 2011 09:36:33 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[开发]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html</guid>
		<description><![CDATA[求新！求变！ 一直以来wordpress的评论也算一个开发重点，每个主题制作者在评论展现方式上的开发也下足了功夫，但是也不外乎都是样式上的变化。淫淫网的新鲜事都可以评论，我很喜欢这种即时评论的方式。所以一直有想法想要移植过来到wordpress上，但是又很懒，所以没有动手。说到懒，博客很久没更新了，很多评论也没回复。 前天有空，所以便动手搞了一下，发现还是很容易的。主要的实现思路说一下： 首先是要设置评论嵌套为2层 只有两层的话，我们就可以将第一层（主评论）当做主体，然后第二层都是对其的回复。 其次在是每条主评论下插入一个输入框 这个对于自定义评论显示结构的主题来说是很容易的，只要在functions.php中的评论回调函数中加上一个textarea就行了。具体的样式就需要自己去定义了，我就不多说了，更具体些的动态变化（点击展开输入框，焦点移开复原输入框）则需要js控制了。我是将这个框简单化，只有一条，点击后用js展开（第三点要说的）。 &#60;?php if ($depth===1): ?&#62; &#60;div class=&#34;quick-comment-form&#34;&#62; &#60;textarea class=&#34;quick-comment&#34;&#62;&#60;/textarea&#62; &#60;/div&#62; &#60;?php endif; ?&#62; 这样子插入的输入框都是直接附加到主评论后面的，本来其实我想实现的是，有子评论时我想将输入框直接输出到子评论的末尾，但是最后没有实现。有做到的同学可以可以与我不吝分享下哈。 点击输入框展开完整的评论输入 就想淫淫网的一样，点击后展开输入区域。wordpress这里涉及到两点，第一，用户登录，第二未登录。未登录下还分有cookie记录用户名 邮箱和没有这些信息。我是通过一段js代码将这些信息输出到页面上，以供后续代码调用判断。 &#60;?php $commenter=array( 'login' =&#62; (bool)is_user_logged_in(), 'author' =&#62; $username, 'email' =&#62; $useremail, 'url' =&#62; $userurl, 'avatar' =&#62; get_avatar($useremail, [...]]]></description>
			<content:encoded><![CDATA[<p><img style="display: inline" title="renren" alt="renren" src="http://www.qiqiboy.com/wp-content/uploads/2011/07/renren.png" width="504" height="208" /></p>
<p>求新！求变！</p>
<p>一直以来wordpress的评论也算一个开发重点，每个主题制作者在评论展现方式上的开发也下足了功夫，但是也不外乎都是样式上的变化。淫淫网的新鲜事都可以评论，我很喜欢这种即时评论的方式。所以一直有想法想要移植过来到wordpress上，但是又很懒，所以没有动手。说到懒，博客很久没更新了，很多评论也没回复。</p>
<p>  <span id="more-2813"></span>
<p>前天有空，所以便动手搞了一下，发现还是很容易的。主要的实现思路说一下：</p>
<h3>首先是要设置评论嵌套为2层</h3>
<p>只有两层的话，我们就可以将第一层（主评论）当做主体，然后第二层都是对其的回复。</p>
<h3>其次在是每条主评论下插入一个输入框</h3>
<p>这个对于自定义评论显示结构的主题来说是很容易的，只要在functions.php中的评论回调函数中加上一个textarea就行了。具体的样式就需要自己去定义了，我就不多说了，更具体些的动态变化（点击展开输入框，焦点移开复原输入框）则需要js控制了。我是将这个框简单化，只有一条，点击后用js展开（第三点要说的）。</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&lt;?php <span style="color: #0000ff">if</span> ($depth===1): ?&gt;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    &lt;div <span style="color: #0000ff">class</span>=<span style="color: #006080">&quot;quick-comment-form&quot;</span>&gt;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        &lt;textarea <span style="color: #0000ff">class</span>=<span style="color: #006080">&quot;quick-comment&quot;</span>&gt;&lt;/textarea&gt;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    &lt;/div&gt;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&lt;?php <span style="color: #0000ff">endif</span>; ?&gt;</pre>
</div>
</div>
<p>这样子插入的输入框都是直接附加到主评论后面的，本来其实我想实现的是，有子评论时我想将输入框直接输出到子评论的末尾，但是最后没有实现。有做到的同学可以可以与我不吝分享下哈。</p>
<h3>点击输入框展开完整的评论输入</h3>
<p>就想淫淫网的一样，点击后展开输入区域。wordpress这里涉及到两点，第一，用户登录，第二未登录。未登录下还分有cookie记录用户名 邮箱和没有这些信息。我是通过一段js代码将这些信息输出到页面上，以供后续代码调用判断。 </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&lt;?php </pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $commenter=<span style="color: #0000ff">array</span>(</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #006080">'login'</span> =&gt; (<span style="color: #0000ff">bool</span>)is_user_logged_in(),</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #006080">'author'</span> =&gt; $username,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #006080">'email'</span> =&gt; $useremail,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #006080">'url'</span> =&gt; $userurl,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #006080">'avatar'</span> =&gt; get_avatar($useremail, 32)</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    );</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">echo</span> <span style="color: #006080">'&lt;script id=&quot;guestbookcommentlist&quot; type=&quot;text/javascript&quot;&gt;window.commenter='</span>.json_encode($commenter).<span style="color: #006080">';&lt;/script&gt;'</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">?&gt;</pre>
</div>
</div>
<p>这样我就可以知道用户有没有登录，也可以很方便的取到用户存储在cookie中的用户名和邮箱值了，还有头像。</p>
<p>取得以上信息后我们就可以通过js操纵dom来将评论框展开，加上输入姓名 邮箱的部分。第一步是初始状态的输入框在获得焦点后（onfocus）后要展开，这点容易，我们直接循环对每个输入框绑定onfocus事件就行了。第二步则是要实现恢复展开的输入框为初始状态。这个不能用失焦（onblur）来做了。因为输入框下可能会有姓名 邮箱等其它输入部分，我们点击那些输入域或者回复按钮时会造成评论框失焦触发动作。所以这样是不行的。我是通过document的click事件，然后取得srcElement，通过和包含评论框、姓名 邮箱输入的那个节点（div#quick-comment-form）的contains关系比较来判断是否需要关闭恢复评论框。 </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">addListener(document,<span style="color: #006080">'click'</span>,<span style="color: #0000ff">function</span>(e){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">var</span> target=window.event &amp;&amp; window.event.srcElement||e &amp;&amp; e.target;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span>(<span style="color: #0000ff">var</span> i=0;i&lt;quickcomments.length;i++){<span style="color: #008000">//quickcomments为取得的所有快速输入框的集合</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span>(quickcomments[i].value==<span style="color: #006080">''</span> &amp;&amp; !contains(quickcomments[i].parentNode,target)){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">//处理部分</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">},<span style="color: #0000ff">false</span>);</pre>
</div>
</div>
<h3>最后就是发布评论了</h3>
<p>这个就简单了，就是一个简单的ajax评论。登陆用户直接只取评论内容和post_id, comment_parent_id格式化后发送就行了。未登录用户还要去获取下姓名 邮箱输入的值，然后一块发送。后台加上相应的响应代码就行了。<br />
  </p>
<p>&#160;</p>
<p>Over。说的很简单，也没具体的代码，大家凑活看。主要是想说wordpress的评论其实可以千变万化，做出很多的新奇来。</p>
<p>我博客还没加上这个，不过这儿有一个<a href="http://www.mhtml5.com/guestbook" target="_blank"><strong>线上例子</strong></a>，也欢迎大家有html5相关的问题到这里进行提问，会有一帮热心人帮助你的。<a href="http://www.mhtml5.com/guestbook" target="_blank">点此浏览效果</a>。<img style="display: inline" title="h5" alt="h5" src="http://www.qiqiboy.com/wp-content/uploads/2011/07/h5.png" width="520" height="244" /></p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/09/rrr.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress 搜索自定义字段(模糊查询)" class="thumb" /><a href="http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html" title="wordpress 搜索自定义字段(模糊查询)">wordpress 搜索自定义字段(模糊查询)</a> (18)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/08/demo.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress 按首字母排列文章/检索文章" class="thumb" /><a href="http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html" title="wordpress 按首字母排列文章/检索文章">wordpress 按首字母排列文章/检索文章</a> (19)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/02/312e53cfb85c.gif&amp;h=100&amp;w=100&amp;zc=1" alt="WordPress技术: 无限多级楼层显示" class="thumb" /><a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html" title="WordPress技术: 无限多级楼层显示">WordPress技术: 无限多级楼层显示</a> (61)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/d3a7458847ca_B553/222.png&amp;h=100&amp;w=100&amp;zc=1" alt="超级无语的新一代中文spam" class="thumb" /><a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html" title="超级无语的新一代中文spam">超级无语的新一代中文spam</a> (87)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/08/spam5.png&amp;h=100&amp;w=100&amp;zc=1" alt="围观wordpress中文圈内好玩的spam" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html" title="围观wordpress中文圈内好玩的spam">围观wordpress中文圈内好玩的spam</a> (133)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/ex">http://qiqi.boy.im/ex<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2012年01月15日, <a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html#comment-16906">citier</a> say: 之前做主题就是卡在评论页面的美化上，你这个比较帅</li><li>2011年12月20日, <a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html#comment-16514">hit9</a> say: 好cool啊，你的评论部分很给力！</li><li>2011年12月20日, <a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html#comment-16513">hit9</a> say: 来测试下</li><li>2011年11月20日, <a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html#comment-15710">MurphyL</a> say: 哈哈～来学习啊～</li><li>2011年09月21日, <a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html#comment-14667">set sail</a> say: 介个很不错啊，有没有放淫淫网那种相册的每张图片都可以评论的创建啊</li><li>2011年08月13日, <a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html#comment-12444">sprityaoyao</a> say: 不错，我也改成这样的了</li><li>2011年07月22日, <a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html#comment-12229">yetone</a> say: 不错，尝试下</li><li>2011年07月21日, <a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html#comment-12216">套图部落</a> say: 很好的功能，按方法尝试下，希望能成功。</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html/feed</wfw:commentRss>
		<slash:comments>46</slash:comments>
		</item>
		<item>
		<title>WordPress技术: 无限多级楼层显示</title>
		<link>http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html</link>
		<comments>http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html#comments</comments>
		<pubDate>Wed, 02 Feb 2011 15:49:49 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[楼层]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html</guid>
		<description><![CDATA[wordpress评论分为悬浮@回复和嵌套回复。前者显示楼层容易，一层一层累计下来就行，而后者则麻烦了些，因为如果也一层层按时间顺序累计，那么嵌套的子评论往往会打乱评论的楼层。所以大家普遍采用主评论楼层显示。我曾经也写了一篇关于主评论楼层显示的文章《wordpress指定页面评论数+支持分页的楼层显示》。 现在对这个主评论楼层进行了改进，支持了子评论楼层。 什么意思呢？ 其实就是说每个评论的直接子评论(不包括孙子评论)当做一个楼层计数系统。 比如有一条评论A，有八条回复此评论的子评论（B1到B8），那么这八条评论就按照时间·顺序从1开始累计楼层。如果还有其它评论是对这八条评论的回复（即这八条评论的直接子评论，即A的孙子评论），那么他们也按照他们各自的父级评论从1开始排序。如下图所示： 正如图所示，具体的实例，大家可以到这个地址查看，请看仔细些： 多级无限楼层数展示 实现代码 其实实现思路还是原来那种主评论显示方法。主评论显示我们在wp的评论自定义显示调用函数中使用一个全局变量来存储楼层数（分页楼层的计算我这里就不说了，我以前的那篇文章里讲有，很多博友也写过）。 我这里的多级楼层其实也还是使用一个全局变量，只不过这个变量的类型变了，不是一个整型，而是一个数组。同样的我们要在函数里开头部分先声明引入全局变量$comemntcount： global $commentcount; 然后是初始化，其实就是检测下这个变量有无定义： $max_depth=$args['max_depth'];//获得设置的最大嵌套数 if(!$commentcount) { $commentcount = array();//声明为数组 $pagenum=get_query_var('cpage')-1;//获得当前分页（减一是为了后面计算使用） $page_comment_count=get_option('comments_per_page');//获得设置的每页评论数 $commentcount[0] = $pagenum * $page_comment_count;//$commentcount的第一个元素存入计算得出的前面分页的评论数目 $commentcount[$max_depth]=0;//这里$commentcount[$max_depth]是用数组的最后一个存储上个评论的楼层数，这里初始置为0 } 上面最后一行用到了$commenntcount[$max_depth]，我们要用$commentcount数组存储每一层测楼层计数，所以最后一层，即$commenntcount[$max_depth]来存储上一条评论的楼层数，因为我们下面要用到它，来判断是否需要重置相应楼层对应的计数器。 &#60;span class=&#34;comment-meta&#34;&#62;//我以楼层输出处为例，介绍下后续的处理 //$depth为当前打印的评论的楼层数，$commentcount[$depth-1]即为此楼层对应的计数器，如果不存在就置为1，否则就+1 &#60;?php if(!$commentcount[$depth-1])$commentcount[$depth-1]=1;else $commentcount[$depth-1]++; $floor = '#'.$commentcount[$depth-1]; //输出楼层显示 echo [...]]]></description>
			<content:encoded><![CDATA[<p>wordpress评论分为悬浮@回复和嵌套回复。前者显示楼层容易，一层一层累计下来就行，而后者则麻烦了些，因为如果也一层层按时间顺序累计，那么嵌套的子评论往往会打乱评论的楼层。所以大家普遍采用主评论楼层显示。我曾经也写了一篇关于主评论楼层显示的文章《<a href="http://www.qiqiboy.com/2010/07/24/wordpress-specify-the-number-of-support-page-page-comment-on-the-floor-show.html"><strong>wordpress指定页面评论数+支持分页的<em>楼层</em>显示</strong></a>》。</p>
<p>现在对这个主评论楼层进行了改进，支持了子评论楼层。</p>
<p>  <span id="more-2709"></span><br />
<blockquote>
<p><strong>什么意思呢？</strong></p>
<p>其实就是说每个评论的直接子评论(不包括孙子评论)当做一个楼层计数系统。</p>
<p>比如有一条评论A，有八条回复此评论的子评论（B1到B8），那么这八条评论就按照时间·顺序从1开始累计楼层。如果还有其它评论是对这八条评论的回复（即这八条评论的直接子评论，即A的孙子评论），那么他们也按照他们各自的父级评论从1开始排序。如下图所示：<img style="margin: ; padding-left: ; padding-right: ; display: inline; padding-top: " title="楼层显示" alt="楼层显示" src="http://www.qiqiboy.com/wp-content/uploads/2011/02/312e53cfb85c.gif" width="600" height="690" /></p>
</blockquote>
<p>正如图所示，具体的实例，大家可以到这个地址查看，请看仔细些：</p>
<p align="center"><font color="#008000" size="4"><strong><a href="http://www.qiqiboy.com/guestbook/comment-page-6#comment-9892" target="_blank">多级无限楼层数展示</a></strong></font></p>
<h3 align="left">实现代码</h3>
<p>其实实现思路还是原来那种主评论显示方法。主评论显示我们在wp的评论自定义显示调用函数中使用一个全局变量来存储楼层数（分页楼层的计算我这里就不说了，我以前的那篇文章里讲有，很多博友也写过）。</p>
<p>我这里的多级楼层其实也还是使用一个全局变量，只不过这个变量的类型变了，不是一个整型，而是一个数组。同样的我们要在函数里开头部分先声明引入全局变量$comemntcount：
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">global $commentcount;</pre>
</div>
</p></div>
</p>
<p>然后是初始化，其实就是检测下这个变量有无定义：</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">$max_depth=$args[<span style="color: #006080">'max_depth'</span>];<span style="color: #008000">//获得设置的最大嵌套数</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">if</span>(!$commentcount) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $commentcount = <span style="color: #0000ff">array</span>();<span style="color: #008000">//声明为数组</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $pagenum=get_query_var(<span style="color: #006080">'cpage'</span>)-1;<span style="color: #008000">//获得当前分页（减一是为了后面计算使用）</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $page_comment_count=get_option(<span style="color: #006080">'comments_per_page'</span>);<span style="color: #008000">//获得设置的每页评论数</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $commentcount[0] = $pagenum * $page_comment_count;<span style="color: #008000">//$commentcount的第一个元素存入计算得出的前面分页的评论数目</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $commentcount[$max_depth]=0;<span style="color: #008000">//这里$commentcount[$max_depth]是用数组的最后一个存储上个评论的楼层数，这里初始置为0</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
</div>
</p></div>
</p>
<p>上面最后一行用到了$commenntcount[$max_depth]，我们要用$commentcount数组存储每一层测楼层计数，所以最后一层，即$commenntcount[$max_depth]来存储上一条评论的楼层数，因为我们下面要用到它，来判断是否需要重置相应楼层对应的计数器。</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&lt;span <span style="color: #0000ff">class</span>=<span style="color: #006080">&quot;comment-meta&quot;</span>&gt;<span style="color: #008000">//我以楼层输出处为例，介绍下后续的处理</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #008000">//$depth为当前打印的评论的楼层数，$commentcount[$depth-1]即为此楼层对应的计数器，如果不存在就置为1，否则就+1</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    &lt;?php <span style="color: #0000ff">if</span>(!$commentcount[$depth-1])$commentcount[$depth-1]=1;<span style="color: #0000ff">else</span> $commentcount[$depth-1]++;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        $floor = <span style="color: #006080">'#'</span>.$commentcount[$depth-1];</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">//输出楼层显示</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">echo</span> <span style="color: #006080">'&lt;a href=&quot;'</span> . htmlspecialchars( get_comment_link( $comment-&gt;comment_ID ) ) . <span style="color: #006080">'&quot;&gt;'</span> . $floor . <span style="color: #006080">'&lt;/a&gt;'</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">/* 下面就是重点了，$commentcount[$max_depth]里存储上个评论的嵌套层数，如果上个评论所在层数大于当前评论的层数，说明</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">            当前评论时更高一级评论，所以要重置低级层数的评论的=计数器 */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span>($commentcount[$max_depth]&amp;&amp;$commentcount[$max_depth]&gt;$depth){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">for</span> ($i=$depth;$i&lt;$max_depth;$i++){<span style="color: #008000">//利用循环将低级的计数器都置为0</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    $commentcount[$i]=0;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        $commentcount[$max_depth]=$depth;<span style="color: #008000">//将当前评论层数赋给$commentcount[$max_depth]</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    ?&gt;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&lt;/span&gt;</pre>
</div>
</div>
<p>OK，到此就介绍完了，说的比较混乱，大家凑活着看。多级楼层支持任意嵌套层数。</p>
<p>也许还有人不明白何为多级嵌套层数，不明白的同学可以尽情在此篇文章下尽情灌水，尽情嵌套，来观察不同嵌套层数的楼层的变化。</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/renren.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress开发 - 仿淫淫网新鲜事评论的评论列表实现" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html" title="wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现">wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现</a> (46)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/d3a7458847ca_B553/222.png&amp;h=100&amp;w=100&amp;zc=1" alt="超级无语的新一代中文spam" class="thumb" /><a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html" title="超级无语的新一代中文spam">超级无语的新一代中文spam</a> (87)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/08/spam5.png&amp;h=100&amp;w=100&amp;zc=1" alt="围观wordpress中文圈内好玩的spam" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html" title="围观wordpress中文圈内好玩的spam">围观wordpress中文圈内好玩的spam</a> (133)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/04f81548e0d5_ED6C/aaf4bbb60650.png&amp;h=100&amp;w=100&amp;zc=1" alt="【原理指导篇】无时不在的评论 侧边栏即时回复功能" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html" title="【原理指导篇】无时不在的评论 侧边栏即时回复功能">【原理指导篇】无时不在的评论 侧边栏即时回复功能</a> (25)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/thumbcache/omg_smile.gif&amp;h=100&amp;w=100&amp;zc=1" alt="补充《修改trackback样式，统一评论外观》中代码" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/05/added-edit-trackback-style-in-the-code.html" title="补充《修改trackback样式，统一评论外观》中代码">补充《修改trackback样式，统一评论外观》中代码</a> (36)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/af">http://qiqi.boy.im/af<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2011年12月20日, <a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html#comment-16515">mr.citier</a> say: ajax运用的神奇啊，来学习学习</li><li>2011年11月29日, <a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html#comment-16103">vven</a> say: <a href="#comment-16092" rel="nofollow">@vven </a> 
如果到了最右边会怎样呢？</li><li>2011年11月29日, <a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html#comment-16102">vven</a> say: 博主，不要不让我说话呀，我是很诚心来学习的！</li><li>2011年11月29日, <a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html#comment-16100">vven</a> say: 我还能说话吗？</li><li>2011年11月29日, <a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html#comment-16099">vven</a> say: <a href="#comment-9937" rel="nofollow">@QiQiBoY </a> 
博主大人，我刚才发的怎么没有了呀？</li><li>2011年11月29日, <a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html#comment-16098">vven</a> say: <a href="#comment-16092" rel="nofollow">@vven </a> 
nini你在哪里？</li><li>2011年11月29日, <a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html#comment-16097">nini</a> say: <a href="#comment-16090" rel="nofollow">@vven </a> 
一直跟下去，try</li><li>2011年11月29日, <a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html#comment-16096">nini</a> say: 我评论的到哪里去鸟</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html/feed</wfw:commentRss>
		<slash:comments>61</slash:comments>
		</item>
		<item>
		<title>wordpress评论系统的回复、引用二合一</title>
		<link>http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html</link>
		<comments>http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html#comments</comments>
		<pubDate>Sun, 16 Jan 2011 18:57:26 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[折腾]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html</guid>
		<description><![CDATA[<p><img style="border-bottom: ; border-left: ; margin: ; padding-left: ; padding-right: ; display: inline; border-top: ; border-right: ; padding-top: " title="捕获.PNG  633×337" alt="捕获.PNG  633×337" src="http://www.qiqiboy.com/wp-content/uploads/2011/01/PNG-633337.png" width="681" height="345" /></p>

<p>可以看到，我是将每条评论放到 <strong>li#li-comment-{id}</strong> 标签里，然后紧接着有个 <strong>div#comment-{id} </strong>的容器，这个容器中就是真正的本条评论的相关内容了。如果这条评论有子评论，那么会在与<strong>div#comment-{id}</strong> 容器平级的节点上有个<strong> ul.children li#li-comment-{id} …</strong> 的后继结点，我们这里不用管它。</p>

<p>上图中绿色方框中的两个a标签即为回复和引用按钮，其中回复按钮的目标链接我简化成了个锚点，如果你使用wp的内置函数生成回复按钮，那么href中与此不同。建议你使用wp内置函数生成按钮。</p>

<p>接下来的橘黄色的箭头所指即为评论者名字获取的节点，这样我们可以方便的通过 a#commentauthor-{id} .innerHTMl 来取得评论者的名字。</p>

<p>最后的紫色箭头即为评论内容，div#commentbody-{id}，也是直接通过innerHTML取得内容。</p>]]></description>
			<content:encoded><![CDATA[<p>我在前面的时候介绍过引用功能的添加（非jquery方法）：《<a href="http://www.qiqiboy.com/2010/07/15/easily-create-your-own-wordpress-quote-reply-function.html" target="_blank"><font color="#008000">添加引用按钮——轻松打造属于你的WordPress引用回复功能</font></a>》。</p>
<p>现在我还想再来说一下基于原生JS的回复和引用功能的添加方法，并且是使用监听器绑定事件，不污染DOM节点，力争做到行为与内容分离。</p>
<h3>先来看下我的一条评论的结构</h3>
<p><img style="margin: ; padding-left: ; padding-right: ; display: inline; padding-top: " title="捕获.PNG  633×337" alt="捕获.PNG  633×337" src="http://www.qiqiboy.com/wp-content/uploads/2011/01/PNG-633337.png" width="681" height="345" /></p>
<p>可以看到，我是将每条评论放到 <strong>li#li-comment-{id}</strong> 标签里，然后紧接着有个 <strong>div#comment-{id} </strong>的容器，这个容器中就是真正的本条评论的相关内容了。如果这条评论有子评论，那么会在与<strong>div#comment-{id}</strong> 容器平级的节点上有个<strong> ul.children li#li-comment-{id} …</strong> 的后继结点，我们这里不用管它。</p>
<p>上图中绿色方框中的两个a标签即为回复和引用按钮，其中回复按钮的目标链接我简化成了个锚点，如果你使用wp的内置函数生成回复按钮，那么href中与此不同。建议你使用wp内置函数生成按钮。</p>
<p>接下来的橘黄色的箭头所指即为评论者名字获取的节点，这样我们可以方便的通过 a#commentauthor-{id} .innerHTMl 来取得评论者的名字。</p>
<p>最后的紫色箭头即为评论内容，div#commentbody-{id}，也是直接通过innerHTML取得内容。</p>
<p>  <span id="more-2595"></span><br />
<h3>进入javascript代码分析部分</h3>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">var</span> $$=<span style="color: #0000ff">function</span>(c, t, p) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">try</span>{</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">var</span> at = p.getElementsByTagName(t);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }<span style="color: #0000ff">catch</span>(e){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">var</span> at = document.getElementsByTagName(t);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">var</span> ms = <span style="color: #0000ff">new</span> Array();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">for</span> (<span style="color: #0000ff">var</span> i = 0; i &lt; at.length; i++)</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (<span style="color: #0000ff">new</span> RegExp(<span style="color: #006080">&quot;(?:^|\\s+)&quot;</span> + c + <span style="color: #006080">&quot;(?:\\s+|$)&quot;</span>).test(at[i].className))</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            ms.push(at[i]);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> ms;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">},</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">addListener=<span style="color: #0000ff">function</span>(e, n, o, u){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span>(e.addEventListener) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        e.addEventListener(n, o, u);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    } <span style="color: #0000ff">else</span> <span style="color: #0000ff">if</span>(e.attachEvent) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        e[<span style="color: #006080">'e'</span> + n + o] = o;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        e[n + o] = <span style="color: #0000ff">function</span>() {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            e[<span style="color: #006080">'e'</span> + n + o](window.<span style="color: #0000ff">event</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        };</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        e.attachEvent(<span style="color: #006080">'on'</span> + n, e[n + o]);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">},</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">preventDefault=<span style="color: #0000ff">function</span>(e){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span>(window.<span style="color: #0000ff">event</span>){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        window.<span style="color: #0000ff">event</span>.returnValue = <span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (e.preventDefault){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        e.preventDefault();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">},</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">replyQuote={</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    start : <span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">/* 先判断页面上有无评论 */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span>(!($(<span style="color: #006080">'thecomments'</span>)&amp;&amp;$(<span style="color: #006080">'commentform'</span>)&amp;&amp;$(<span style="color: #006080">'comment'</span>)))<span style="color: #0000ff">return</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">/* $$为根据类名获取结点簇的函数，function $$(className,tagName,parent) */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">var</span> comments=$$(<span style="color: #006080">'comment'</span>,<span style="color: #006080">'li'</span>,$(<span style="color: #006080">'thecomments'</span>)),</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">/* 通过 input#comment_post_id 这个隐藏域获取当前页面ID */</span>            </pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            postId=$(<span style="color: #006080">'comment_post_ID'</span>).value;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">for</span>(<span style="color: #0000ff">var</span> i=0;i&lt;comments.length;i++){<span style="color: #008000">/* 循环绑定 */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            replyQuote.reply(comments[i],postId);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            replyQuote.quote(comments[i]);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        </pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    },</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    </pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    reply : <span style="color: #0000ff">function</span>(comment,postId){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">/* 过滤掉“li-comment-”来取得最终的id值</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">            */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">var</span> id=comment.id.replace(/li-comment-/i,<span style="color: #006080">''</span>),</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">/* commentId即为取得div#comment-{id}做准备 */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            commentId=<span style="color: #006080">'comment-'</span>+id,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">/* replyLink即为回复按钮 */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            replyLink=$$(<span style="color: #006080">'comment-reply-link'</span>,<span style="color: #006080">'a'</span>,$(commentId))[0],</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">/* 这里是取得父级id，应用了我以前文章中介绍的无限嵌套原理</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">               在最后一层评论的回复按钮上输出一个自定义的 p属性，如</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">                &lt;a href=&quot;#comment-{id}&quot; class=&quot;...&quot; p=&quot;父级评论ID&quot;&gt;Reply&lt;/a&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">             使用JS检测是否有p属性，有的话就取这个p属性值</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">             */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            parentId=replyLink.getAttribute(<span style="color: #006080">'p'</span>)?replyLink.getAttribute(<span style="color: #006080">'p'</span>):id,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">/* 这里得到评论者名字 */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            authorId=<span style="color: #006080">'commentauthor-'</span>+id,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            author=$(authorId).innerHTML.replace(/\t|\n|\r\n/g, <span style="color: #006080">&quot;&quot;</span>),</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">/* insertStr为要插入的内容 */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            insertStr=<span style="color: #006080">'&lt;a href=&quot;#'</span> + commentId + <span style="color: #006080">'&quot;&gt;@'</span> + author + <span style="color: #006080">' &lt;/a&gt; \n'</span>,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            field;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">/* addListener为事件绑定函数，即监听器。这里绑定回复按钮的点击事件 */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        addListener(replyLink,<span style="color: #006080">'click'</span>,<span style="color: #0000ff">function</span>(e){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">/* 移动评论框 */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            preventDefault(e)</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            addComment.moveForm(commentId, parentId, <span style="color: #006080">'respond'</span>, postId);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> ($(<span style="color: #006080">'comment'</span>) &amp;&amp; $(<span style="color: #006080">'comment'</span>).type == <span style="color: #006080">'textarea'</span>) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                field = $(<span style="color: #006080">'comment'</span>)</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            } <span style="color: #0000ff">else</span> {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                alert(<span style="color: #006080">&quot;The comment box does not exist!&quot;</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> (field.value.indexOf(insertStr) &gt; -1) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                alert(<span style="color: #006080">&quot;已经回复过这条评论了!&quot;</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> (field.value.replace(/\s|\t|\n/g, <span style="color: #006080">''</span>) == <span style="color: #006080">''</span>) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                field.value = insertStr;<span style="color: #008000">//如果评论为空就直接添加进去</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            } <span style="color: #0000ff">else</span> {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #008000">//否则就先去除末尾的空格再空一行添加</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                field.value = field.value.replace(/[\n]*$/g, <span style="color: #006080">&quot;&quot;</span>) + <span style="color: #006080">'\n\n'</span> + insertStr;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            field.focus();<span style="color: #008000">//最后将焦点移到评论框中</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        },<span style="color: #0000ff">false</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    },</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    </pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #008000">/* 以下类似，有些自定义函数我没给出 */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    quote:<span style="color: #0000ff">function</span>(comment){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">var</span> id=comment.id.replace(/li-comment-/i,<span style="color: #006080">''</span>),</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            commentBodyId=<span style="color: #006080">'commentbody-'</span>+id,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            commentCont=$(commentBodyId).innerHTML,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            author=$(<span style="color: #006080">'commentauthor-'</span>+id).innerHTML.replace(/\t|\n|\r\n/g, <span style="color: #006080">&quot;&quot;</span>),</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            commentId=<span style="color: #006080">'comment-'</span>+id,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            quoteLink=$$(<span style="color: #006080">'comment-quote-link'</span>,<span style="color: #006080">'a'</span>,$(commentId))[0],</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            insertStr=<span style="color: #006080">'&lt;blockquote cite=&quot;#'</span> + commentBodyId + <span style="color: #006080">'&quot;&gt;'</span>+</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                      <span style="color: #006080">'\n&lt;strong&gt;&lt;a href=&quot;#'</span> + commentId + <span style="color: #006080">'&quot;&gt;'</span> + author + <span style="color: #006080">'&lt;/a&gt; :&lt;/strong&gt;'</span>+</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                      commentCont.replace(/\t/g, <span style="color: #006080">&quot;&quot;</span>)+<span style="color: #006080">'&lt;/blockquote&gt;\n'</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        addListener(quoteLink,<span style="color: #006080">'click'</span>,<span style="color: #0000ff">function</span>(e){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">//addEditor($('comment'),insertStr);</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">              preventDefault(e);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">              $(<span style="color: #006080">'comment'</span>).value+=insertStr;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        },<span style="color: #0000ff">false</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    </pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">replyQuote.start();</pre>
</div>
</div>
<p>OK, 完事！</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/07/qw.png&amp;h=100&amp;w=100&amp;zc=1" alt="为评论框添加文字格式化编辑器" class="thumb" /><a href="http://www.qiqiboy.com/2010/07/26/to-comment-box-to-add-text-formatting-editor.html" title="为评论框添加文字格式化编辑器">为评论框添加文字格式化编辑器</a> (116)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/07/b3b47b6400e6.png&amp;h=100&amp;w=100&amp;zc=1" alt="添加引用按钮&mdash;&mdash;轻松打造属于你的WordPress引用回复功能" class="thumb" /><a href="http://www.qiqiboy.com/2010/07/15/easily-create-your-own-wordpress-quote-reply-function.html" title="添加引用按钮&mdash;&mdash;轻松打造属于你的WordPress引用回复功能">添加引用按钮&mdash;&mdash;轻松打造属于你的WordPress引用回复功能</a> (32)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/02/confirm.png&amp;h=100&amp;w=100&amp;zc=1" alt="javascript自定义Dialog对话框(alert, confirm, prompt) -- (一)" class="thumb" /><a href="http://www.qiqiboy.com/2011/02/22/custom-javascript-dialog-alert-prompt.html" title="javascript自定义Dialog对话框(alert, confirm, prompt) &#8212; (一)">javascript自定义Dialog对话框(alert, confirm, prompt) &#8212; (一)</a> (31)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/12/e77406ff9f03.png&amp;h=100&amp;w=100&amp;zc=1" alt="永不丢失的评论 - 打造wordpress评论框的本地化存储方案" class="thumb" /><a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html" title="永不丢失的评论 &#8211; 打造wordpress评论框的本地化存储方案">永不丢失的评论 &#8211; 打造wordpress评论框的本地化存储方案</a> (115)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/wordpressWaveYourTheme_4EC0/5677.png&amp;h=100&amp;w=100&amp;zc=1" alt="【插件发布】wordpress主题预览插件-Wave Your Theme（换装游戏）" class="thumb" /><a href="http://www.qiqiboy.com/2010/09/23/wordpress-plugins-wave-your-theme.html" title="【插件发布】wordpress主题预览插件-Wave Your Theme（换装游戏）">【插件发布】wordpress主题预览插件-Wave Your Theme（换装游戏）</a> (70)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/a9">http://qiqi.boy.im/a9<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2011年10月24日, <a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html#comment-15213">倡萌</a> say: 很强大的评论功能，有时间好好研究一下</li><li>2011年07月15日, <a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html#comment-12073">mirror</a> say: <blockquote cite="#commentbody-11009">
<strong><a href="#comment-11009" rel="nofollow">sprityaoyao</a> :</strong>
这个我在emlog曾经没有嵌套的时候实现了，现在嵌套了，好像不行了。不过你这个方法可以借鉴
</blockquote></li><li>2011年06月26日, <a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html#comment-11751">zdy</a> say: good</li><li>2011年05月2日, <a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html#comment-11009">sprityaoyao</a> say: 这个我在emlog曾经没有嵌套的时候实现了，现在嵌套了，好像不行了。不过你这个方法可以借鉴</li><li>2011年04月22日, <a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html#comment-10886">小雪</a> say: 好久没来啦~~~赞一个评论框，我喜欢~~~~ <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_smile.gif' alt=':smile:' class='wp-smiley' />  

你的blog 特效好炫好炫啊~~~膜拜膜拜~~~看首页蛮像商业网站了呢~~~~~</li><li>2011年03月2日, <a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html#comment-10082">圣女贞德红</a> say: 从美观来说，JS很多特效的确可以美化网站，但是过多，会影响搜索引擎的收录，而且对自身发展也不好。</li><li>2011年02月16日, <a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html#comment-10017">pepe</a> say: <a href='#comment-10014' rel="nofollow">@Coller</a></li><li>2011年02月16日, <a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html#comment-10014">Coller</a> say: <a href="#comment-9633" rel="nofollow">@QiQiBoY </a> 
Thank you for your topic.</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html/feed</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>永不丢失的评论 &#8211; 打造wordpress评论框的本地化存储方案</title>
		<link>http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html</link>
		<comments>http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html#comments</comments>
		<pubDate>Sat, 11 Dec 2010 13:22:05 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[localStorage]]></category>
		<category><![CDATA[本地存储]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html</guid>
		<description><![CDATA[<p>OK，有了基本的客户端存储方案，那么对于“wordpress永不丢失的评论”这个目标该怎么实现呢？</p>

<p>首先就是要存考虑储评论内容，由于每篇文章、每个页面都不同，所以为了区分每个存储，我们可以使用当前页面或者文章的ID来作为存储键值的参考。这个值可以通过获取页面中“input#comment_post_ID”这个隐藏域的值取得。然后我们可以通过绑定评论框的“onchange”事件来触发设置本地存储。</p>

<p>如果输入的内容没有被发表成功，那么在浏览器刷新或者重新加载此页面时，就要试着去读取相关内容，并显示到评论框里。</p>

<p>在评论发表成功后就要清除本页面上的这个存储或者将其置为空值。</p><p><img style="border-bottom: ; border-left: ; margin: ; padding-left: ; padding-right: ; display: inline; border-top: ; border-right: ; padding-top: " src="http://www.qiqiboy.com/wp-content/uploads/2010/12/e77406ff9f03.png" width="608" height="294" /></p>]]></description>
			<content:encoded><![CDATA[<p>你在浏览网站时一定遇到过这种情况：当你兴致勃勃的在某个网站的留言板或者评论区洋洋洒洒的写了N长的自己的看法或观点，却总会由于各种原因（如突然断网、浏览器假死、系统崩溃等）而导致未发表前就丢失了这些好不容易才写下的内容。当你重新打开浏览器时，这些东西再也无法恢复了，浪费了半天感情。</p>
<p>使用wordpress的同学都知道wp的评论功能处的资料输入框是可以记录你上次评论时输入的姓名、邮箱、网站地址的。这是通过cookie记录的。你可能也想过通过cookie记录评论框输入的内容，但事实是cookie记录信息有限，太长的评论内容可能无法容身，而且由于cookie在每次http请求时都会被提交到服务器，为了尽可能的减少通信延迟，我们就要确保浏览器中存储尽量少的cookie。</p>
<h3>客户端存储方案</h3>
<p>而客户端存储除了cookie，其实还有好多其他方法，如Google Gears、flash、User Data、window.name等，但是这些方法或多或少都由于实现麻烦或者跨浏览器问题而不能单独使用。</p>
<p>综述各类方法，较为方便的一个实现方案是，对于较为现代的浏览器（IE8、IE9、chrome、Firefox、opera等），由于都已经实现了支持localStorage存储方案，所以可以使用这一W3C提倡的方案；而早期的IE则可以使用user Data方案。</p>
<h3>wordpress上的评论内容存储实现思路</h3>
<p>OK，有了基本的客户端存储方案，那么对于“wordpress永不丢失的评论”这个目标该怎么实现呢？</p>
<p>首先就是要考虑存储评论内容，由于每篇文章、每个页面都不同，所以为了区分每个存储，我们可以使用当前页面或者文章的ID来作为存储键值的参考。这个值可以通过获取页面中“input#comment_post_ID”这个隐藏域的值取得。然后我们可以通过绑定评论框的“onchange”事件来触发设置本地存储。</p>
<p>如果输入的内容没有被发表成功，那么在浏览器刷新或者重新加载此页面时，就要试着去读取相关内容，并显示到评论框里。</p>
<p>  <span id="more-2590"></span>
<p>在评论发表成功后就要清除本页面上的这个存储或者将其置为空值。</p>
<h3>具体代码及分析注释</h3>
<p>先看存储功能的实现代码：</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/*!</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @public</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @update 2010/12/11, liuqiqi imqiqiboy#gmail.com http://www.qiqiboy.com</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @param &lt;String&gt; key 键值</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @param &lt;String&gt; value 要存储的值</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @call 设置新值storeLocalData(key, value); || 清除某个存储storeLocalData(key, ''); ||</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000"> *       获取某个存储storeLocalData(key); || 清除所有存储storeLocalData(); </span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">*/</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">var</span> storeLocalData=<span style="color: #0000ff">function</span>(key, value) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">try</span> {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #008000">//先试着获取对localStorage的引用</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">var</span> storage=window.localStorage || window.globalStorage &amp;&amp; window.globalStorage[location.hostname];</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span> (storage){<span style="color: #008000">//如果获取localStorage对象成功，说明浏览器支持localStorage</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> (value !== undefined)<span style="color: #008000">//如果存在value，表示是要设置存储操作</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                value == <span style="color: #006080">&quot;&quot;</span> ? storage.removeItem(key) : storage[key] = value;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">else</span> <span style="color: #0000ff">if</span> (key !== undefined)<span style="color: #008000">//存在key值，就返回相应的存储值</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">return</span> storage[key] || <span style="color: #006080">&quot;&quot;</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">else</span> <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> Error();<span style="color: #008000">//抛出异常，使代码流跳到最后清除存储部分</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }<span style="color: #0000ff">else</span> <span style="color: #0000ff">if</span> (/MSIE/i.test(navigator.userAgent)) {<span style="color: #008000">//确保是IE，IE才能使用userData存储</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">var</span> userData = document.getElementById(<span style="color: #006080">'userData'</span>) || document.createElement(<span style="color: #006080">'input'</span>);<span style="color: #008000">//试着查找‘userData’这个节点，没有就开始创建</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> (!userData.id) {<span style="color: #008000">//没有ID值就说明页面上无此节点</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                userData.id=<span style="color: #006080">&quot;userData&quot;</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                userData.style.display=<span style="color: #006080">'none'</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                userData.style.behavior=<span style="color: #006080">'url(#default#userData)'</span>;<span style="color: #008000">//behavior:url(#default#userData)'表示开启user Data存储</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                document.body.appendChild(userData);<span style="color: #008000">//加载到页面中</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">try</span> {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                userData.load(<span style="color: #006080">&quot;oXMLBranch&quot;</span>)<span style="color: #008000">//尝试载入存储的数据</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            } <span style="color: #0000ff">catch</span>(e) {}</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> (value !== undefined) {<span style="color: #008000">//这里同上面，其实也是通过value判断是设置新值还是返回存储的值</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                value == <span style="color: #006080">&quot;&quot;</span> ? userData.removeAttribute(key) : userData.setAttribute(key, value);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                userData.save(<span style="color: #006080">&quot;oXMLBranch&quot;</span>);<span style="color: #008000">//保存</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }<span style="color: #0000ff">else</span> <span style="color: #0000ff">if</span> (key !== undefined)<span style="color: #008000">//存在key值，就返回相应的存储值</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">               <span style="color: #0000ff">return</span> userData.getAttribute(key) || <span style="color: #006080">&quot;&quot;</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">           <span style="color: #0000ff">else</span> <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> Error();<span style="color: #008000">//抛出异常，使代码流跳到最后清除存储部分</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        } <span style="color: #0000ff">else</span> <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;<span style="color: #008000">//操作失败</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;<span style="color: #008000">//设置成功</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    } <span style="color: #0000ff">catch</span>(e) {<span style="color: #008000">//捕获到上面抛出的错误</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">       <span style="color: #0000ff">if</span>(storage){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            storage.clear();<span style="color: #008000">//使用W3C的方法清除存储</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        } <span style="color: #0000ff">else</span> <span style="color: #0000ff">if</span> (userData) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">var</span> attrs = userData.xmlDocument.firstChild.attributes, i;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">while</span>(i = attrs.length){<span style="color: #008000">//循环清除xml文件里的每个属性里保存的值</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">var</span> j = attrs[--i].nodeName;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                userData.removeAttribute(j);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            userData.save(<span style="color: #006080">&quot;oXMLBranch&quot;</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">//以下为对localStorage测试的补充,部署到wordpress时不必添加此段代码</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">//设置一个新的存储</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">storeLocalData(<span style="color: #006080">'new_key'</span>, <span style="color: #006080">'new_value'</span>);<span style="color: #008000">//即保存了一个名称为new_key，内容为new_value的存储</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">//获取某个存储</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">storeLocalData(<span style="color: #006080">'new_key'</span>);<span style="color: #008000">//即会返回new_key对应的值，如果new_key上存储了内容，就返回存储的内容，否则返回空字串</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">//删除某个存储</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">storeLocalData(<span style="color: #006080">'new_key'</span>, <span style="color: #006080">''</span>);<span style="color: #008000">//即将某个存储设置为空，即会删除它</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">//删除页面上所有的存储</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">storeLocalData();<span style="color: #008000">//传递任何参数，即会执行清除操作；你可以任何时候通过在浏览器的JS控制台上输入此函数来执行清理。</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">//查看输出页面上所有的storage</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">var</span> storage = window.localStorage;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">if</span>(!storage.length)document.write(<span style="color: #006080">'本页面上无存储内容！'</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">for</span>(<span style="color: #0000ff">var</span> i=0; i&lt;storage.length; i++){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #008000">//输出格式为 &quot;键值 = 存储值&quot;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    document.write(storage.key(i)+<span style="color: #006080">' = '</span>+storage.getItem(storage.key(i))+<span style="color: #006080">'&lt;br/&gt;'</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
</div>
</div>
<p>根据我代码中的注释，其实可以看出，设置一个新的存储，就调用storeLocalData(键值, 新值)；获取一个存储，就只提供键值即可，storeLocalData(键值)；</p>
<p>然后要和wordpress的评论机制结合起来。</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">//这些代码务必放在评论框下方，否则就使用window.onload包含调用，或者jQuery的ready方法调用</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">function</span> $(id){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> document.getElementById(id);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">function</span> addListener(e, n, o, u) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span>(e.addEventListener) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        e.addEventListener(n, o, u);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    } <span style="color: #0000ff">else</span> <span style="color: #0000ff">if</span>(e.attachEvent) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        e[<span style="color: #006080">'e'</span> + n + o] = o;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        e[n + o] = <span style="color: #0000ff">function</span>() {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            e[<span style="color: #006080">'e'</span> + n + o](window.<span style="color: #0000ff">event</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        };</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        e.attachEvent(<span style="color: #006080">'on'</span> + n, e[n + o]);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/*通过onchange绑定存储行为方式，已弃用该方法，新方法在下边</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">if($(&quot;comment&quot;)){</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    //这里用作存储键值我使用了 'storage_'+数字ID 的方式，因为我测试好像数字字串不能作为localStorage的属性值，原因我暂时不明，有了解的可以提点一下</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    $('comment').value=storeLocalData('storage_'+$('comment_post_ID').value);</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000"> </span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    addListener($('comment'),'change',function(){//绑定 onchange 事件</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">        storeLocalData('storage_'+$('comment_post_ID').value, $('comment').value);</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    },false);</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000"> </span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    addListener($('commentform'),'submit',function(){//绑定评论表单的 onsubmit 事件</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">        storeLocalData('storage_'+$('comment_post_ID').value, '');//这里置为空就可以了</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    },false);</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">}</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">*/</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">//以下内容为2010.12.14日更新</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">if</span>($(<span style="color: #006080">&quot;comment&quot;</span>)){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #008000">//这里用作存储键值我使用了 'storage_'+数字ID 的方式，因为我测试好像数字字串不能作为localStorage的属性值，原因我暂时不明，有了解的可以提点一下</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">var</span> local=storeLocalData(<span style="color: #006080">'storage_'</span>+$(<span style="color: #006080">'comment_post_ID'</span>).value), post_id=$(<span style="color: #006080">'comment_post_ID'</span>).value, <span style="color: #008000">//获取之前存储的内容和文章id</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        storeTimer, new_value, old_value=local;<span style="color: #008000">//声明定时器标志，新值、旧值的变量</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $(<span style="color: #006080">'comment'</span>).value= local === undefined? <span style="color: #006080">''</span> : local;<span style="color: #008000">//将评论框内容更新为存储的值</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    addListener($(<span style="color: #006080">'comment'</span>),<span style="color: #006080">'focus'</span>,<span style="color: #0000ff">function</span>(){<span style="color: #008000">//绑定聚焦事件</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span>(!storeTimer)</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        storeTimer=setInterval(<span style="color: #0000ff">function</span>(){<span style="color: #008000">//声明一个定时器，每秒执行一次</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #008000">//if语句的执行会先获取评论框中的值，然后和旧值比较，不同就存储新值，然后就新值赋给旧值，以便下次继续和再次取得新值比较</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span>((new_value=$(<span style="color: #006080">'comment'</span>).value)!==undefined &amp;&amp; new_value!=old_value &amp;&amp; (old_value=new_value)!==undefined)</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                storeLocalData(<span style="color: #006080">'storage_'</span>+post_id, new_value);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        },1000);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    },<span style="color: #0000ff">false</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    addListener($(<span style="color: #006080">'comment'</span>),<span style="color: #006080">'blur'</span>,<span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        clearInterval(storeTimer);storeTimer=undefined;<span style="color: #008000">//焦点移开就清楚定时器</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    },<span style="color: #0000ff">false</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    addListener($(<span style="color: #006080">'commentform'</span>),<span style="color: #006080">'submit'</span>,<span style="color: #0000ff">function</span>(){<span style="color: #008000">//绑定评论表单的 onsubmit 事件</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        storeLocalData(<span style="color: #006080">'storage_'</span>+$(<span style="color: #006080">'comment_post_ID'</span>).value, <span style="color: #006080">''</span>);<span style="color: #008000">//这里置为空就可以了</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    },<span style="color: #0000ff">false</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
</div>
</div>
<p>清除存储我是通过submit事件来执行的，其实更好的方案是修改你的ajax评论代码，在评论发表成功后的回调函数中调用<font color="#008000">storeLocalData(&#8216;storage_&#8217;+$(&#8216;comment_post_ID&#8217;).value, ‘’);</font></p>
<p><font color="#a5a5a5"><strike>对于存储评论内容，我暂时使用onchange，</strike></font>其实我觉得这样并不是最好的，因为onchange事件必须你修改过内容后而且使评论框失去焦点才会触发，但很有可能我们正在书写时浏览器就已经崩溃，此时就无法保存内容了。所以比较保险写的方法是绑定聚焦事件（onfocus），然后通过定时器每过一段时间就执行设置存储。</p>
<p>2010.12.14更新，已经改为onfocus事件与定时器结合方式。具体请详看上方代码。</p>
<h3>具体的实例</h3>
<p>关于本地化客户端存储的例子，像腾讯微博、新浪微博都有应用，你在微博发表框中输入一些内容，然后不要发表；接着关闭浏览器重新打开或者重载页面，就会发现已经输入的内容还会出现在输入框中。</p>
<p>本文所讲的wordpress的评论框存储，可以参看本博的输入框（仅限SimPaled主题，如果你在使用其他主题，请通过右下角的主题切换功能切换到SimPaled）。你可以在任意页面的评论部分输入一些内容，然后点击一下页面其他部分（目的是让评论框失去焦点，触发onchange事件）。你此时可以关闭浏览器或者刷新页面，输入的内容会自动补充进评论框里（请注意如果你以前访问过博客，先强刷浏览器清除JS文件的缓存）。</p>
<p>由于条件限制，我并没有测试过所有浏览器，所以请大家帮忙测试（主要是IE6、IE7），如有问题，欢迎即时告知。</p>
<p>注：已知IE7\IE6下貌似有问题，存储失败。请各位提供更多关于此的测试结果，谢谢。</p>
<p><img style="margin: ; padding-left: ; padding-right: ; display: inline; padding-top: " title="捕获" alt="捕获" src="http://www.qiqiboy.com/wp-content/uploads/2010/12/e77406ff9f03.png" width="608" height="294" /></p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/01/PNG-633337.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress评论系统的回复、引用二合一" class="thumb" /><a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html" title="wordpress评论系统的回复、引用二合一">wordpress评论系统的回复、引用二合一</a> (32)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/04f81548e0d5_ED6C/aaf4bbb60650.png&amp;h=100&amp;w=100&amp;zc=1" alt="【原理指导篇】无时不在的评论 侧边栏即时回复功能" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html" title="【原理指导篇】无时不在的评论 侧边栏即时回复功能">【原理指导篇】无时不在的评论 侧边栏即时回复功能</a> (25)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/07/db801f54ed88.png&amp;h=100&amp;w=100&amp;zc=1" alt="让你的评论框自由粘贴代码" class="thumb" /><a href="http://www.qiqiboy.com/2010/07/30/allows-you-to-paste-the-code-in-the-comments-box-free.html" title="让你的评论框自由粘贴代码">让你的评论框自由粘贴代码</a> (66)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/07/qw.png&amp;h=100&amp;w=100&amp;zc=1" alt="为评论框添加文字格式化编辑器" class="thumb" /><a href="http://www.qiqiboy.com/2010/07/26/to-comment-box-to-add-text-formatting-editor.html" title="为评论框添加文字格式化编辑器">为评论框添加文字格式化编辑器</a> (116)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/07/b3b47b6400e6.png&amp;h=100&amp;w=100&amp;zc=1" alt="添加引用按钮&mdash;&mdash;轻松打造属于你的WordPress引用回复功能" class="thumb" /><a href="http://www.qiqiboy.com/2010/07/15/easily-create-your-own-wordpress-quote-reply-function.html" title="添加引用按钮&mdash;&mdash;轻松打造属于你的WordPress引用回复功能">添加引用按钮&mdash;&mdash;轻松打造属于你的WordPress引用回复功能</a> (32)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/a0">http://qiqi.boy.im/a0<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2012年01月19日, <a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html#comment-16988">爱疯迷Myang</a> say: 很有用的功能，回头倒腾倒腾试试。</li><li>2011年10月3日, <a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html#comment-14922">图你妹</a> say: 这个不错啊，但是太麻烦了，能不能搞一个插件啊。</li><li>2011年08月23日, <a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html#comment-12604">cailman</a> say: 要的就是这个，回头研究研究，楼主写代码的习惯非常好啊。</li><li>2011年07月2日, <a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html#comment-11812">liveme</a> say: 强烈要求博主更新一下，要更加详细的教程啊 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_eek.gif' alt=':shock:' class='wp-smiley' /> </li><li>2011年06月16日, <a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html#comment-11616">Bob</a> say: 评论框旁边的那一列编辑栏实在是太帅了……不知道咋弄的……</li><li>2011年06月5日, <a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html#comment-11513">Microhu</a> say: 请问这两段代码放哪? function?还是?... 求解.</li><li>2011年05月12日, <a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html#comment-11183">iphone5</a> say: 怎么做到的，看起来好复杂啊。mark一下，以后慢慢学</li><li>2011年04月10日, <a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html#comment-10704">扛一肩记忆</a> say: Hi，前辈
能不能指教一下，我如何才能获得你文章最后那幅图的效果，即在评论框的上面出现表情啊，字体啊，之类的东东。。。不甚感激。。。</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html/feed</wfw:commentRss>
		<slash:comments>115</slash:comments>
		</item>
		<item>
		<title>我手贱，我写他妈的那篇文章</title>
		<link>http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html</link>
		<comments>http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html#comments</comments>
		<pubDate>Mon, 08 Nov 2010 07:25:00 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[360]]></category>
		<category><![CDATA[QQ]]></category>
		<category><![CDATA[业界]]></category>
		<category><![CDATA[互联网]]></category>
		<category><![CDATA[观点]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html</guid>
		<description><![CDATA[<p>后来这篇文章从CB被转载到QQ校友上，被大量分享，吸引来了大量的评论，目前已有五千多评论。我大致看了下评论，绝大部分都是在激烈辱骂。<strong><font color="#ff0000">更为让人愤怒的是，大量的网络暴民涌入到第一个分享此文的一个女生的空间里，大量发表辱骂言论，进行恶心的人身攻击。我晚上浏览了很多这些人的个人主页，一个个长得人模狗样的，这不由得让我想起一句话——</font></strong></p>

<p><strong><font color="#ff0000" size="4"><font size="7">“</font><font size="5">在互联网上，没人知道你会幻化成一条狗！</font><font size="7">”</font></font></strong></p>

<p>我博客是添加有访问统计的，所以我能获得很多转载我文章的论坛、博客地址。我抽时间看了很多这些转载地址上的评论，发现还是像IT科技类、互联网类论坛或者独立博客的小圈子中的会独立思考问题者居多，不像QQ空间和人人网的绝大部分用户，都是缺乏基本独立行事判断力的XX。</p><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" class="aligncenter" title="errerer" border="0" alt="errerer" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/121223.png"  />]]></description>
			<content:encoded><![CDATA[<p>在我的文章《<a href="http://www.qiqiboy.com/2010/11/05/take-a-clear-stand-against-immoral-360.html" target="_blank"><strong>旗帜鲜明的反对不道德的360</strong></a>》被转载到cnBeta.Com和QQ空间分享以后，引起了不小的风波。七号左右还一度关闭了这条新闻评论（I don’t care, so who care?），今天发现评论又出现了，不过有一些评论已被删除。</p>
<p>文章最初以<a href="http://cnbeta.com/articles/126332.htm"><strong>[博文]反对360，不代表支持QQ</strong></a>的名字出现在CB上，说实话，我不喜欢这个标题，这个标题稀释了我文章的主题，我写那篇文章的目的就是要赤裸裸的发表我反对360所作所为的立场上，在标题上就要体现——<a href="http://www.qiqiboy.com/2010/11/05/take-a-clear-stand-against-immoral-360.html" target="_blank"><strong>旗帜鲜明的反对不道德的360</strong></a>。</p>
<p>后来这篇文章从CB被转载到QQ校友上，被大量分享，吸引来了大量的评论，目前已有五千多评论。我大致看了下评论，绝大部分都是在激烈辱骂。<strong><font color="#ff0000">更为让人愤怒的是，大量的网络暴民涌入到第一个分享此文的一个女生的空间里，大量发表辱骂言论，进行恶心的人身攻击。我晚上浏览了很多这些人的个人主页，一个个长得人模狗样的，这不由得让我想起一句话——</font></strong></p>
<p><strong><font color="#ff0000" size="4"><font size="7">“</font><font size="5">在互联网上，没人知道你会幻化成一条狗！</font><font size="7">”</font></font></strong></p>
<p>我博客是添加有访问统计的，所以我能获得很多转载我文章的论坛、博客地址。我抽时间看了很多这些转载地址上的评论，发现还是像IT科技类、互联网类论坛或者独立博客的小圈子中的会独立思考问题者居多，不像QQ空间和人人网的绝大部分用户，都是缺乏基本独立行事判断力的XX。</p>
<p>当然，所幸由于这篇文章被转载，都没直接标明我博客的地址，所以大量的SB和水军都没来到我这里。只是文章中留了个我的<a href="http://www.qiqiboy.com/contact" target="_blank"><font color="#008000">联系页面</font></a>的地址，所以6号起床后打开QQ收到了一大堆的好友申请和MSN申请。</p>
<p><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" class="aligncenter" title="errerer" border="0" alt="errerer" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/errerer.png" width="183" height="244" /></p>
<p>我的博客也已经被大量水军淹没，一百来条等待审核的评论。只不过大都是直接辱骂或者发乱码评论的。毫无自己观点，只是纯粹的对我人身攻击，并且言语下流的我直接删除了，其它一些我留了下来，仅当作不同观点。</p>
<p>  <span id="more-2571"></span><br />
<h3>你是腾讯的五毛吧，这么维护腾讯</h3>
<p>我必须说明，我文中并无维护腾讯的意思。</p>
<p>只是，我文中并没有太多批判腾讯的言语。</p>
<p>因为，你要先记住我的文章标题——<a href="http://www.qiqiboy.com/2010/11/05/take-a-clear-stand-against-immoral-360.html" target="_blank"><strong>旗帜鲜明的反对不道德的360</strong></a>。没错，我标题中已明确，我写本文的目的是为了表达我反对360所作所为的观点。那么我有必要去诉说腾讯的不是吗？</p>
<p>如果我下次要写“旗帜鲜明的反对QQ”一文，那么文中会大量抛出我对腾讯种种恶行的所不耻的观点。</p>
<p>但是，抱歉，我本文仅仅想批判360。</p>
<h4>我是腾讯的五毛吗？</h4>
<p>我需要拿着五毛钱去发个帖吗？</p>
<p>请围观我博客以前的文章，我像个五毛吗？五毛有那么多闲情去写那么多根本都他妈的<strong>拿不到五毛的文章</strong>吗？</p>
<p>再说，周鸿祎都把人家水军费用提高到七毛一贴了，要顾我发帖，五毛、七毛的可不够啊！</p>
<h3>你观点太主观了</h3>
<p>这点说的太好了，我本来就是在我博客上写文章，观点当然只是代表我个人。</p>
<p>如果你一上来就<strong><font color="#ff0000">把我绑架到一个中立的新闻媒体的高度</font></strong>，希望我能客观中立的点评两家公司的所作所为，那么抱歉，我不是，我做不到。我<strong>仅仅一个小博主</strong>，一个未毕业学生，一个有点热爱互联网的小网民。</p>
<p>所以，我的观点仅仅代表我自己，代表<strong><a href="http://www.qiqiboy.com" target="_blank">qiqiboy</a></strong>，代表<strong><a href="http://qiqi.boy.im" target="_blank">liuqiqi</a></strong>，代表<strong><a href="http://www.qiqiboy.com" target="_blank">I’m qiqiboy !</a></strong>博客。除此，任何公司、媒体与我无关。</p>
<p>你希望我在批评360时也顺带着批评腾讯，对不起，那已超出本文设定主题范围。</p>
<h3>im=internet message？没文化真可怕……</h3>
<p>被转载的文章中我出现了一个错误，这个错误实在是不该，我现在实在难以解释我怎么写成了“Internet Message”。既然已经写错了，我接受错误，改正错误。</p>
<blockquote><p>IM == Instant Message</p>
</blockquote>
<p>这个错误被大量持相反观点的人和360水军揪着不放，恶语相向，“没文化”、“SB枪手”、“SB五毛”。。。</p>
<p>如果这个就说明我文化程度不高，那么我无言以对，好在我现在还在学校上学，那我就努力学习知识吧！至于，枪手、五毛、七毛或者其他毛的，对不起，我不是。</p>
<p>如果说一个常识错误就代表我是五毛，那么我也无可奈何。</p>
<p>但是，我想说，如果说揪着我的这个错误能激发你的G点，那你就尽情兴奋吧！！</p>
<h3>我为什么写这样一篇文章</h3>
<p>源于我文中已经抛出的种种观点，我一直讨厌360公司的所做所为。但是身边人很多人都在用360，我并不想费此口水向他们一一解释360的恶行。</p>
<p>所以，借此次机会，我想写一篇文章来表明我的观点，当然，主要是想让周围认识的人看看的，因为他们可能网上看到别人对360公司的指责批评，会觉得这篇文章是枪文，是陷害360公司，而我亲自写一篇，让都是认识的人看看，我的亲戚、朋友、同学等等，他们至少会多少相信我所说的吧。所以我才在文章中留下了我的联系页面地址，是希望认识我的人，加过我QQ的那些已经决定不再使用QQ的能加上我的MSN。结果，文章被转载后，却招来了很多陌生人来加好友。</p>
<p>至于造成这么大风波，非我能预料。</p>
<hr />最后，我还是摆明我的观点——
<p><strong><font color="#ff0000">想用QQ，又想摆个高姿态，您装逼就到此吧！</font></strong></p>
<p><strong><font color="#ff0000">世界第八大奇迹：两亿网民忍辱负重上QQ！</font></strong></p>
<p>如果还有人来骂，那我只怪<strong><font color="#ff0000">我手贱，我脑残得去写那篇文章。</font></strong></p>
<p><strong><font color="#ff0000">观点不同，可以各自表述，但是拒绝激烈的人身攻击。</font></strong></p>
<hr /><strong><font color="#ff0000">提供一些真相截图：</font></strong>
<p><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" class="aligncenter" title="121223" border="0" alt="121223" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/121223.png" width="352" height="344" /></p>
<p align="center">这是对我直接人身攻击的，邮箱<a href="mailto:fanconglei@yahoo.cn">fanconglei@yahoo.cn</a></p>
<p align="center"><img style="margin: ; padding-left: ; padding-right: ; display: inline; padding-top: " class="aligncenter" title="222222222" alt="222222222" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/222222222.png" width="603" height="206" /><img style="margin: ; padding-left: ; padding-right: ; display: inline; padding-top: " title="3333333" alt="3333333" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/3333333.png" width="602" height="219" /></p>
<p align="center">这个是两篇新闻对比，请看红框中所圈部分，评论数，CB的新闻正常情况下只有几十条评论，最多一百多条。而我这篇新闻的评论却达到了四百余条（截图系六号所截，七号CB一度关闭评论，至八号中午已有四百五十余条。其实应该会远多于这个，因为中午时评论数就是324了，一直到晚上都没变过，不知怎么回事，包括热门评论的支持反对数，也都不变了。），多出的这二百多条评论从哪里来？<strong><font color="#ff0000">当然是360顾的七毛党水军啦！！</font></strong></p>
<p align="center">欢迎大家去围观CB上的评论，地址在这儿<a title="http://cnbeta.com/articles/126332.htm" href="http://cnbeta.com/articles/126332.htm" target="_blank"><strong><font color="#ff0000">http://cnbeta.com/articles/126332.htm</font></strong></a><img style="margin: ; padding-left: ; padding-right: ; display: block; float: none; padding-top: " title="3434" alt="3434" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/3434.png" width="622" height="310" /></p>
<p align="center">这个是某人从CB转载到了QQ空间，被很多人分享。截至6号下午四点，已有5024次分享，5160人发表观点，三千多条评论（看来大家讨论很激烈呀）。当然，依然是绝大部分都是辱骂博主和腾讯公司的。还好，没多少人顺藤摸瓜摸来我博客骂我。</p>
<p align="center">QQ空间及校友围观地址：<a title="http://pengyou.qq.com/index.php?mod=usershare&amp;act=show&amp;sid=1289008702&amp;u=c265e4bd629300c559ad69fcf3c35da66d8ff7b507f66077&amp;ADTAG=HZ_feed_T2" href="http://pengyou.qq.com/index.php?mod=usershare&amp;act=show&amp;sid=1289008702&amp;u=c265e4bd629300c559ad69fcf3c35da66d8ff7b507f66077&amp;ADTAG=HZ_feed_T2" target="_blank"><strong><font color="#ff0000">http://pengyou.qq.com/index.php?mod=usershare&amp;act=show&amp;sid=1289008702&amp;u=c265e4bd629300c559ad69fcf3c35da66d8ff7b507f66077&amp;ADTAG=HZ_feed_T2</font></strong></a></p>
<p align="center"><img style="margin: ; padding-left: ; padding-right: ; display: block; float: none; padding-top: " title="101106191346f928961af5c771" alt="101106191346f928961af5c771" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/101106191346f928961af5c771.jpg" width="576" height="641" /></p>
<p align="center">一些真相</p>
<p align="center"><img style="margin: ; padding-left: ; padding-right: ; display: inline; padding-top: " title="qqqq" alt="qqqq" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/qqqq.png" width="316" height="129" /><img style="margin: ; padding-left: ; padding-right: ; display: inline; padding-top: " class="aligncenter" title="45555" alt="45555" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/45555.png" width="389" height="184" /><img style="margin: ; padding-left: ; padding-right: ; display: inline; padding-top: " title="qqqqq" alt="qqqqq" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/qqqqq.png" width="478" height="174" /><img style="border-bottom: medium none; border-left: medium none; margin: ; padding-left: ; padding-right: ; display: inline; border-top: medium none; border-right: medium none; padding-top: " title="rrrr" alt="rrrr" src="http://www.qiqiboy.com/wp-content/uploads/2010/11/rrrr.png" width="548" height="223" /></p>
<p align="center">当然，也有一些人专门加我好友，专门说一句支持我，赞同我的观点。我很感谢这些网友。</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/11/2010110416055645.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="旗帜鲜明的反对不道德的360" class="thumb" /><a href="http://www.qiqiboy.com/2010/11/05/take-a-clear-stand-against-immoral-360.html" title="旗帜鲜明的反对不道德的360">旗帜鲜明的反对不道德的360</a> (114)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/renren.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress开发 - 仿淫淫网新鲜事评论的评论列表实现" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html" title="wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现">wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现</a> (46)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/02/312e53cfb85c.gif&amp;h=100&amp;w=100&amp;zc=1" alt="WordPress技术: 无限多级楼层显示" class="thumb" /><a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html" title="WordPress技术: 无限多级楼层显示">WordPress技术: 无限多级楼层显示</a> (61)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/01/PNG-633337.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress评论系统的回复、引用二合一" class="thumb" /><a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html" title="wordpress评论系统的回复、引用二合一">wordpress评论系统的回复、引用二合一</a> (32)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/12/e77406ff9f03.png&amp;h=100&amp;w=100&amp;zc=1" alt="永不丢失的评论 - 打造wordpress评论框的本地化存储方案" class="thumb" /><a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html" title="永不丢失的评论 &#8211; 打造wordpress评论框的本地化存储方案">永不丢失的评论 &#8211; 打造wordpress评论框的本地化存储方案</a> (115)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/9l">http://qiqi.boy.im/9l<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2011年11月26日, <a href="http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html#comment-15998">Bob</a> say: 其实不用理会，这个社会啥人都有，just take it easy...</li><li>2011年08月26日, <a href="http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html#comment-12618">电视剧里开始</a> say: 不错，原来的360还不错，我在做网吧网关是，把电脑里的所有电脑都撞上了360，但是这两年再也不装了，360的用户都是死忠，他们愿意用就用吧。反正是他的电脑，不用为他们发愁。</li><li>2011年08月14日, <a href="http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html#comment-12448">断竹挽风</a> say: 360明显的外挂行为，直接将QQ的安全页给绑架了。</li><li>2011年07月16日, <a href="http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html#comment-12118">代码回音</a> say: 坚持表达自己的观点</li><li>2011年06月7日, <a href="http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html#comment-11542">熊猫小子</a> say: 额，网络很可怕。还是潜水比较好。</li><li>2011年05月16日, <a href="http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html#comment-11241">sprityaoyao</a> say: 哎，现在的网络呀，太恐怖了。我支持博主</li><li>2011年05月14日, <a href="http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html#comment-11213">Melody</a> say: 天朝人的素质吗？</li><li>2011年04月24日, <a href="http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html#comment-10919">千与琥珀</a> say: 唉，五毛是多了点</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2010/11/08/cheap-my-hand-i-wrote-the-article-fuck.html/feed</wfw:commentRss>
		<slash:comments>122</slash:comments>
		</item>
		<item>
		<title>WP RC Reply AJAX插件开放公用接口，附修改版ajax-comments.js</title>
		<link>http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html</link>
		<comments>http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html#comments</comments>
		<pubDate>Fri, 08 Oct 2010 11:53:15 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[WP-RC-Reply-AJAX]]></category>
		<category><![CDATA[接口]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html</guid>
		<description><![CDATA[
<p>就是这么简单。另外，我修改了一下willin kan的ajax评论方案中的JS文件，版本是1.29(貌似说是1.30不兼容3.0.1之前版本，所以我的修改基于1.29版本)。其实也就是在ajax评论的success方法中直接调用了接口函数，如下图<img style="border-bottom: ; border-left: ; margin: ; padding-left: ; padding-right: ; display: inline; border-top: ; border-right: ; padding-top: " title="最新评论" alt="最新评论" src="http://www.qiqiboy.com/wp-content/uploads/2010/557a6a721f3c_DD5E/bc97cde4ad95.png" width="650" height="221" /></p>



<p>我修改过的文件，你可以直接到此下载，然后替换你以前的ajax评论中的JS文件即可：</p>

<p><a title="http://u.115.com/file/f46b026a9" href="http://u.115.com/file/f46b026a9"><strong><font color="#ff0000" size="3">http://u.115.com/file/f46b026a9</font></strong></a></p>]]></description>
			<content:encoded><![CDATA[<p>有心留意的同学也许会发现，在我的博客发表留言成功后，右边栏的最新评论列表处就会实时显示刚发表的这条评论。这个其实很简单，我只是在ajax评论的成功回调函数中调用了我的边栏的评论获取函数，刷新了一下边栏显示。</p>
<p>我开发了<a href="http://www.qiqiboy.com/plugins/wp-rc-reply-ajax"><strong>WP RC Reply AJAX</strong></a>插件后，使用本插件的同学，现在你只要更新到2.0.3，也可以使用<a href="http://www.qiqiboy.com/plugins/wp-rc-reply-ajax"><strong>WP RC Reply AJAX</strong></a>的公共接口了。 </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/**</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    * @Overview WP RC Reply AJAX插件刷新接口</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    * @author liuqiqi</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    * @public interface: WIDGET.RCCMT</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    * @param none</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    * @version 1.0</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span>(window.WIDGET &amp;&amp; window.WIDGET.RCCMT != undefined){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        window.WIDGET.RCCMT();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
</div>
</div>
<p>如上面所示，你只需在合适时候调用<strong><font color="#ff0000">WIDGET.RCCMT()</font></strong>这个函数就行了。为了防止插件失效或者其他原因导致接口失效，我加了个if判断。</p>
<p><span id="more-2541"></span></p>
<p>具体的这个接口怎么使用呢？</p>
<p>比如，你可以写一个定时刷新的JS函数，通过此接口来设定一个固定时间刷新评论列表 </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">/**</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    * @Overview 定时刷新边栏最新评论列表DEMO</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    * @author liuqiqi</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    * @param time 刷新间隔，单位是分钟。默认值是三分钟</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    * @date 2010/10/08</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">    */</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">function</span> setRefrush(_time){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">var</span> time = (_time || 3) *60*1000;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        setInterval(<span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span>(window.WIDGET &amp;&amp; window.WIDGET.RCCMT != undefined){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                window.WIDGET.RCCMT();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }, time);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    </pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    setRefrush(5);<span style="color: #008000">//调用函数，每五分钟刷新评论列表</span></pre>
</div>
</div>
<p>就是这么简单。另外，我修改了一下willin kan的ajax评论方案中的JS文件，版本是1.29(貌似说是1.30不兼容3.0.1之前版本，所以我的修改基于1.29版本)。其实也就是在ajax评论的success方法中直接调用了接口函数，如下图<img style="margin: ; padding-left: ; padding-right: ; display: inline; padding-top: " title="最新评论" alt="最新评论" src="http://www.qiqiboy.com/wp-content/uploads/2010/557a6a721f3c_DD5E/bc97cde4ad95.png" width="650" height="221" /></p>
<p>我修改过的文件，你可以直接到此下载，然后替换你以前的ajax评论中的JS文件即可：</p>
<p><a title="http://u.115.com/file/f46b026a9" href="http://u.115.com/file/f46b026a9"><strong><font color="#ff0000" size="3">http://u.115.com/file/f46b026a9</font></strong></a></p>
<p>如果文件共享过期，请通知我。</p>
<p>至于这个效果的DEMO嘛。。你直接在我这里评论，然后到边栏最新评论处去瞅自己的评论吧。。哈哈。。</p>
<p>注意是SimPaled主题。ajaxPaled下。。嘿嘿。。。</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/09/11.png&amp;h=100&amp;w=100&amp;zc=1" alt="Widget Ajax评论查看回复插件-WP RC Reply AJAX 升到1.2.1" class="thumb" /><a href="http://www.qiqiboy.com/2010/09/09/wp-rc-reply-ajax-rose-to-1-2-1.html" title="Widget Ajax评论查看回复插件-WP RC Reply AJAX 升到1.2.1">Widget Ajax评论查看回复插件-WP RC Reply AJAX 升到1.2.1</a> (73)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/08/1de9fb000bac.png&amp;h=100&amp;w=100&amp;zc=1" alt="插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/20/wordpress-plugin-wp-rc-reply-ajax.html" title="插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX">插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX</a> (188)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/04f81548e0d5_ED6C/aaf4bbb60650.png&amp;h=100&amp;w=100&amp;zc=1" alt="【原理指导篇】无时不在的评论 侧边栏即时回复功能" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html" title="【原理指导篇】无时不在的评论 侧边栏即时回复功能">【原理指导篇】无时不在的评论 侧边栏即时回复功能</a> (25)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/07/fdf.png&amp;h=100&amp;w=100&amp;zc=1" alt="修正关于Ajax comments的一个小问题" class="thumb" /><a href="http://www.qiqiboy.com/2010/07/31/ajax-comments-amendment-on-a-small-problem.html" title="修正关于Ajax comments的一个小问题">修正关于Ajax comments的一个小问题</a> (46)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/renren.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress开发 - 仿淫淫网新鲜事评论的评论列表实现" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html" title="wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现">wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现</a> (46)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/92">http://qiqi.boy.im/92<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2011年06月24日, <a href="http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html#comment-11698">iyunloian</a> say: 看一下~~~~~~~~</li><li>2011年01月26日, <a href="http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html#comment-9818">QiQiBoY</a> say: <a href="#comment-9817" rel="nofollow">@demo </a> 
已经更新了，可以下载了 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_razz.gif' alt=':razz:' class='wp-smiley' /> </li><li>2011年01月26日, <a href="http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html#comment-9817">demo</a> say:  <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_razz.gif' alt=':razz:' class='wp-smiley' />  下载失效了呢</li><li>2010年10月18日, <a href="http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html#comment-7150">QiQiBoY</a> say: <a href="#comment-7149" rel="nofollow">@宿迁学院论坛 </a> 
我已经是全站ajax了。。http://qiqi.boy.im/ajax
任何人也都可以全站ajax了、、http://www.qiqiboy.com/plugins/enjoy-reading</li><li>2010年10月18日, <a href="http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html#comment-7149">宿迁学院论坛</a> say: 你的WP要成全ajax站了~</li><li>2010年10月16日, <a href="http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html#comment-7096">QiQiBoY</a> say: <a href="#comment-7094" rel="nofollow">@MOPVHS </a> 
不是，是你的主题里的smokeeffect-min.js在IE8下出错，导致插件的JS无法运行。。。你要解决你的这个JS在IE8下的错误才行</li><li>2010年10月16日, <a href="http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html#comment-7095">QiQiBoY</a> say: <a href="#comment-7094" rel="nofollow">@MOPVHS </a> 
刷新浏览器就好了。。是JS没加载。。</li><li>2010年10月16日, <a href="http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html#comment-7094">MOPVHS</a> say: 对了，Chrome下：

WordPress 先生
嗨，这是一条评论。要删除一条评论...»

IE8下：

WordPress 先生
嗨，这是一条评论。要删除一条评论...</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2010/10/08/wp-rc-reply-ajax-plug-in-open-common-interface.html/feed</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
		<item>
		<title>超级无语的新一代中文spam</title>
		<link>http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html</link>
		<comments>http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html#comments</comments>
		<pubDate>Sun, 03 Oct 2010 05:10:29 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[Spam]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[中文圈]]></category>
		<category><![CDATA[垃圾评论]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2010/10/03/%e8%af%b7%e9%94%ae%e5%85%a5%e6%96%87%e5%ad%97%e6%88%96%e7%bd%91%e7%ab%99%e5%9c%b0%e5%9d%80%ef%bc%8c%e6%88%96%e8%80%85%e4%b8%8a%e4%bc%a0%e6%96%87%e6%a1%a3%e3%80%82.html</guid>
		<description><![CDATA[<p>请围观<img style="border-bottom: ; border-left: ; margin: ; padding-left: ; padding-right: ; display: inline; border-top: ; border-right: ; padding-top: " title="222" alt="222" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam12.png" width="864" height="1057" /></p>

<p>这些spam个个顶着一个好看、养眼的、不是帅锅就是木女的头像，操着一口带着你的博客名的地道崇拜语，一会说“天来看你的博客，一会说自己的博客太烂，一会儿又装作无辜的仿佛小白问些二里吧唧的问题。。。。。</p>

<p>炯炯。。。。这些spam二代。。。多的不说，大家自己看。。。。</p>

<p>以后的spam不朝这些spam看齐，你说你还好意思出来混吗？</p>]]></description>
			<content:encoded><![CDATA[<p>接上一篇《<a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html" target="_blank"><u><strong><font style="background-color: #000000" color="#ffffff">围观wordpress中文圈内好玩的spam</font></strong></u></a>》，最近又发现了好好多多的spam，但是一直觉得他们新意不够，总是那一套：“国庆愉快”、“中秋快乐”、“拜读您的大作了”、“博主最近很少更新了呵呵”、“学习了，马上折腾去”、“我为啥总是出错呢，博主您就折腾的这么好”。。。。</p>
<p>我说过，我判断spam的标准就是看有无gravatar头像，无头像的统统垃圾评论，有头像的是spam也要被我拉出来。但是，从昨天起，我发现我不能这么做了，因为新一代、令人超级无语的spam二代出炉了。。。</p>
<p>铛铛☭☭☭☭☭☭☭☭☭☭….(没想到搜狗还能打出党的标志)。。</p>
<p>请围观<img style="border-bottom: ; border-left: ; margin: ; padding-left: ; padding-right: ; display: inline; border-top: ; border-right: ; padding-top: " title="222" alt="222" src="http://www.qiqiboy.com/wp-content/uploads/2010/d3a7458847ca_B553/222.png" width="864" height="1057" /></p>
<p>这些spam个个顶着一个好看、养眼的、不是帅锅就是木女的头像，操着一口带着你的博客名的地道崇拜语，一会说“天来看你的博客，一会说自己的博客太烂，一会儿又装作无辜的仿佛小白问些二里吧唧的问题。。。。。</p>
<p>炯炯。。。。这些spam二代。。。多的不说，大家自己看。。。。</p>
<p>以后的spam不朝这些spam看齐，你说你还好意思出来混吗？</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/08/spam5.png&amp;h=100&amp;w=100&amp;zc=1" alt="围观wordpress中文圈内好玩的spam" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html" title="围观wordpress中文圈内好玩的spam">围观wordpress中文圈内好玩的spam</a> (133)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/renren.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress开发 - 仿淫淫网新鲜事评论的评论列表实现" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html" title="wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现">wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现</a> (46)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/02/312e53cfb85c.gif&amp;h=100&amp;w=100&amp;zc=1" alt="WordPress技术: 无限多级楼层显示" class="thumb" /><a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html" title="WordPress技术: 无限多级楼层显示">WordPress技术: 无限多级楼层显示</a> (61)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/07/fdf.png&amp;h=100&amp;w=100&amp;zc=1" alt="修正关于Ajax comments的一个小问题" class="thumb" /><a href="http://www.qiqiboy.com/2010/07/31/ajax-comments-amendment-on-a-small-problem.html" title="修正关于Ajax comments的一个小问题">修正关于Ajax comments的一个小问题</a> (46)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/01/PNG-633337.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress评论系统的回复、引用二合一" class="thumb" /><a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html" title="wordpress评论系统的回复、引用二合一">wordpress评论系统的回复、引用二合一</a> (32)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/8u">http://qiqi.boy.im/8u<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2011年11月27日, <a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html#comment-16025">小米04</a> say: 直接在把他们IP封了 现在很少有了 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_razz.gif' alt=':razz:' class='wp-smiley' /> </li><li>2011年06月25日, <a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html#comment-11731">情歌</a> say: 为毛我收到的都是英文的。。。。看也看不懂</li><li>2011年05月19日, <a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html#comment-11265">EIIE</a> say: 都是AOL的邮箱... <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_idea.gif' alt=':idea:' class='wp-smiley' /> </li><li>2011年05月19日, <a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html#comment-11263">明月登楼</a> say: 呵呵，这spam也太给力了吧！人工生成的吗？如果是机器自动生成的，那可是太牛X了！</li><li>2010年10月27日, <a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html#comment-7546">唱歌的笨金鱼</a> say: spam年年有，今年特别多</li><li>2010年10月24日, <a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html#comment-7447">zhy</a> say: 真是太敬业了，都不知道拿他怎么办了~~要是我一天最多一个就放过了——不知道你封了IP没有</li><li>2010年10月16日, <a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html#comment-7093">Suyos</a> say: <a href="#comment-7081" rel="nofollow">@liuqiqi </a> 
不过不怕。我有小墙，小墙拦截了这类的。杯具的是，英文的很明显的Spam却没判断出来。</li><li>2010年10月16日, <a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html#comment-7081">liuqiqi</a> say: <a href="#comment-7080" rel="nofollow">@Suyos </a> 
嘿嘿。。。这下你如愿了。。</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html/feed</wfw:commentRss>
		<slash:comments>87</slash:comments>
		</item>
		<item>
		<title>围观wordpress中文圈内好玩的spam</title>
		<link>http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html</link>
		<comments>http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html#comments</comments>
		<pubDate>Tue, 31 Aug 2010 12:43:55 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[Spam]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2010/08/31/%e5%9b%b4%e8%a7%82wordpress%e4%b8%ad%e6%96%87%e5%9c%88%e5%86%85%e5%a5%bd%e7%8e%a9%e7%9a%84spam.html</guid>
		<description><![CDATA[
<h3>类型九，两个蠢蛋型</h3>

<p><img style="display: inline" title="spam1" alt="spam1" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam1.png" width="576" height="90" /></p>

<p>你老板够蠢，居然不知道你在假装工作，你更蠢，明知道他在假装付你薪水，还为他工作浪费时间。</p>]]></description>
			<content:encoded><![CDATA[<h3>类型一，灌水马甲型</h3>
<p><img style="display: inline" title="spam6" alt="spam6" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam6.png" width="572" height="312" /></p>
<p>从12:26到13:26正好一个小时内换了三个马甲来发spam，看来时间把握这么精准，一定是定时spam的。</p>
<h3>类型二，无知装逼型</h3>
<p><img style="display: inline" title="spam7" alt="spam7" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam7.png" width="569" height="85" /></p>
<p>特点，客客气气的先说句客套话，然后就出现个傻逼的问题“你用的什么主题？”主题信息底部写有。</p>
<h3>类型三，谎话连篇型</h3>
<p><img style="display: inline" title="spam8" alt="spam8" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam8.png" width="558" height="97" /></p>
<p>其实一分钟也没在俺博客呆过。</p>
<h3>类型五，纯粹废话型</h3>
<p><img style="display: inline" title="spam9" alt="spam9" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam9.png" width="550" height="101" /></p>
<p>要是spam也能坐上沙发，那我真是发那篇文章时倒霉到家了，这都能和spam遇上！！！</p>
<h3>类型六，毫不羞耻吹捧型</h3>
<p><img style="display: inline" title="spam10" alt="spam10" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam10.png" width="517" height="80" /></p>
<p><img style="display: inline" title="spam11" alt="spam11" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam11.png" width="537" height="89" /></p>
<p>其实夸赞俺，俺也很高兴，但是别发错文章呀，这个spam却正好发在一篇写我上当受骗的文章下面，靠，我倒霉你还在下面叫好！！！</p>
<p>  <span id="more-2513"></span><br />
<h3>类型七，论坛灌水积分党</h3>
<p><img style="display: inline" title="spam12" alt="spam12" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam12.png" width="575" height="320" /></p>
<p>这种贴子的出现源于很多人士想在天涯看连载小说，但是天涯一些论坛的功能只有一定积分才能使用，于是出现了一大堆类似的帖子，专门用来刷积分。</p>
<p>但是，拜托，我这里不是天涯论坛。</p>
<h3>类型八，狗咬狗</h3>
<p><img style="display: inline" title="spam0" alt="spam0" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam0.png" width="579" height="93" /></p>
<p>我想说的是，WP的垃圾评论早已出了，akismet。</p>
<h3>类型九，两个蠢蛋型</h3>
<p><img style="display: inline" title="spam1" alt="spam1" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam1.png" width="576" height="90" /></p>
<p>你老板够蠢，居然不知道你在假装工作，你更蠢，明知道他在假装付你薪水，还为他工作浪费时间。</p>
<h3>类型十，非人类</h3>
<p><img style="display: inline" title="spam2" alt="spam2" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam2.png" width="581" height="92" /></p>
<p>这位发评论的都说了，人家是咔咕。</p>
<h3>类型十一，类新手型</h3>
<p><img style="display: inline" title="spam3" alt="spam3" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam3.png" width="510" height="100" /></p>
<p>刚开博客的新手大概都会有段时间喜欢去别人博客留这样的话</p>
<h3>类型十二，alibibi</h3>
<p><img style="display: inline" title="spam4" alt="spam4" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam4.png" width="574" height="96" /></p>
<p>此位域名实在太个性。马云看到了就震精了。</p>
<h3>类型十三，让我无语型</h3>
<p><img style="display: inline" title="spam5" alt="spam5" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/spam5.png" width="549" height="90" /></p>
<p>男科医生都来了，还自称砖家，请问前列腺能治吗？</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/d3a7458847ca_B553/222.png&amp;h=100&amp;w=100&amp;zc=1" alt="超级无语的新一代中文spam" class="thumb" /><a href="http://www.qiqiboy.com/2010/10/03/a-new-generation-of-super-silent-chinese-spam.html" title="超级无语的新一代中文spam">超级无语的新一代中文spam</a> (87)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/renren.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress开发 - 仿淫淫网新鲜事评论的评论列表实现" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html" title="wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现">wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现</a> (46)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/02/312e53cfb85c.gif&amp;h=100&amp;w=100&amp;zc=1" alt="WordPress技术: 无限多级楼层显示" class="thumb" /><a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html" title="WordPress技术: 无限多级楼层显示">WordPress技术: 无限多级楼层显示</a> (61)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/07/fdf.png&amp;h=100&amp;w=100&amp;zc=1" alt="修正关于Ajax comments的一个小问题" class="thumb" /><a href="http://www.qiqiboy.com/2010/07/31/ajax-comments-amendment-on-a-small-problem.html" title="修正关于Ajax comments的一个小问题">修正关于Ajax comments的一个小问题</a> (46)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/01/PNG-633337.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress评论系统的回复、引用二合一" class="thumb" /><a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html" title="wordpress评论系统的回复、引用二合一">wordpress评论系统的回复、引用二合一</a> (32)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/7u">http://qiqi.boy.im/7u<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2011年03月25日, <a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html#comment-10407">布布</a> say: 总结的很多啊，看来是因为你的博客比较火。
我的就不是你这样了，里面最多的就是一大堆英文的那种，虽说是英文，但看起来好像有中文直接翻译的影子，弄不好也是国人所为。</li><li>2011年02月24日, <a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html#comment-10050">何苦呢</a> say: 最后一个男科医生 我也遇到过哦 哈哈</li><li>2010年10月12日, <a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html#comment-6821">Hello WordPress! - I'm qiqiboy !</a> say: [...] 2010.08 我继续折腾，期间我修改trackback样式，统一评论外观，也分享了这个修改中的一些涉及到的代码补充《修改trackback样式，统一评论外观》中代码。这期间，我对ajax兴趣逐渐浓厚起来，所以便有了这个博客加入若干Ajax效果。在折腾ajax、延迟加载中，我遇到了页面文档初始化的一些问题，于是查阅文档便有了这篇JavaScript页面文档初始化 window.onload的替代办法；后来，我有了在侧边栏开发ajax即时评论的想法，于是便出现了【效果测试展示篇】Ajax版即时侧边栏评论回复功能，掉了几天大家的胃口，然后又简单的蜻蜓点水般【原理指导篇】无时不在的评论 侧边栏即时回复功能。八月份期间，我的SimPaled主题基本上成型了，于是我将它介绍了给大家【SimPaled篇】Introduce My Blog Theme For You。很哟意思的是，我看到了腾讯微博的头像悬浮显示，于是便仿了下来仿腾讯微博式访客信息悬浮显示（JavaScript &amp; ajax）。基于边栏评论，为了方便大家，我开发了插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX。后来发现wordpress的无限嵌套的邮件回复有问题，于是有了完美解决wordpress无限嵌套&lt;二&gt; 【邮件发送相关问题】。因为SimPaled主题用到了很多延迟加载，所以有同学问我延迟加载怎样实现，于是我分享了自己当时的思路JS延迟加载机制函数(Lazyload)。八月份最后一件事大概要算我在博客中曝光了中文spam里的那些极品好玩的spam吧围观wordpress中文圈内好玩的spam [...]</li><li>2010年10月6日, <a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html#comment-6531">Google不爱我</a> say: 我對付這些spamer的措施就是把有意思的放出來圍觀～不過至今還沒遇到這裡這麼搞喜的……感覺我的那個地方沒有spam的話還蠻冷清的 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_razz.gif' alt=':razz:' class='wp-smiley' /> </li><li>2010年10月3日, <a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html#comment-6323">超级无语的新一代中文spam - I'm qiqiboy !</a> say: [...] 接上一篇《围观wordpress中文圈内好玩的spam》，最近又发现了好好多多的spam，但是一直觉得他们新意不够，总是那一套：“国庆愉快”、“中秋快乐”、“拜读您的大作了”、“博主最近很少更新了呵呵”、“学习了，马上折腾去”、“我为啥总是出错呢，博主您就折腾的这么好”。。。。 [...]</li><li>2010年09月18日, <a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html#comment-5763">小王子</a> say: 没办法啊确实让人愤恨，现在开始人肉输入垃圾评论的时代了，怎么办，怎么禁止？</li><li>2010年09月13日, <a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html#comment-5534">IM路人</a> say: 我勒个去，看到这些就恶心，厚颜无耻，一群自以为是的SEOer，一边玩蛋去吧</li><li>2010年09月13日, <a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html#comment-5519">毕扬</a> say: 互访么~互访也很必要，就像我现在不就是在做援交　哈哈

<a href="#comment-5518" rel="nofollow">@QiQiBoY </a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html/feed</wfw:commentRss>
		<slash:comments>133</slash:comments>
		</item>
		<item>
		<title>完美解决wordpress无限嵌套&lt;二&gt; 【邮件发送相关问题】</title>
		<link>http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html</link>
		<comments>http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html#comments</comments>
		<pubDate>Mon, 23 Aug 2010 15:45:37 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[嵌套]]></category>
		<category><![CDATA[程序]]></category>
		<category><![CDATA[评论]]></category>
		<category><![CDATA[邮件]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html</guid>
		<description><![CDATA[<img class="alignleft" src="http://www.qiqiboy.com/wp-content/uploads/2010/07/111.png" alt="wordpress嵌套" title="wordpress嵌套" ><p>但是，后来出现一个问题，让我不得不重新思考无限嵌套这一方式。这个问题就是邮件回复问题。了解我实现无限嵌套原理的，应该的都知道其实在对最后一层进行回复时，是在变相的对倒数第二层进行回复。很多人可能在使用<strong>willin</strong>修改的邮件发送方式，即是通过<strong>hook</strong>到<strong>comment_post</strong>，获取新评论的父级评论ID，如果ID不为0，说明这是一条子评论，然后就将邮件发送给父级评论。父级评论的邮箱是来自get_comment()函数获取数据库查询。前面已经说了，对最后一层的回复是<font style="background-color: #ffff00">变相地对倒数第二层进行回复</font>，所以此时邮件全部发送到倒数第二层那里去了。</p>

<p>我注意到上面的问题，来自于一次我在开发自己的ajax评论时对我在最后一层的评论进行回复测试时，结果zww跑来跟我说，收到一大堆我的邮件。我研究了一下，发现存在上述问题，在搁置了N天后，今天我终于解决了它。</p>

<p>这个问题的解决需要换个思路，不能还是局限于通过查询一条评论的父级ID来判断需不需要发送邮件。我注意到我的每条评论中都有@回复链接，而其中的href中就包含了被回复者的评论id，所以我就从这里着手，想通过获取评论中的存在的@回复来进行邮件发送。而且这种方式，你可以一次回复多个人，比如你想在一条评论里同时回复A、B、C三个人，你只需要依次点击A、B、C下面的reply按钮（如果不想让评论框出现在这三人任何一人下方，则点击一下取消回复，评论框会回到底部，这条回复会被当做一条主评论。但是，别担心，评论框内容不会清空，你的回复依然会通过邮件发送至这三人），然后书写回复内容即可。</p>]]></description>
			<content:encoded><![CDATA[<p>我曾在《<a href="http://www.qiqiboy.com/2010/07/07/perfect-solution-wordpress-nested-layers-deep-back-problems.html"><strong><font color="#ff0000">完美解决WordPress嵌套回复的层深问题（无限嵌套）&lt;一&gt;</font></strong></a>》中分享了我对wordpress中嵌套深度有限的应对解决办法。有同学注意到了我标题中的<font style="background-color: #ffff00"><u>&lt;一&gt;</u></font>，所以问我<font style="background-color: #d19049">&lt;二&gt;</font>何时出来。我回答说，没有二了，因为这个已经是完美的了，标题中的一是无意中加进去的。</p>
<p>但是，后来出现一个问题，让我不得不重新思考无限嵌套这一方式，从而也就有了本文——《完美无限嵌套&lt;二&gt;》。这个问题就是邮件回复问题。了解我实现无限嵌套原理的，应该的都知道其实在对最后一层进行回复时，是在变相的对倒数第二层进行回复。很多人可能在使用<strong>willin</strong>修改的邮件发送方式，即是通过<strong>hook</strong>到<strong>comment_post</strong>，获取新评论的父级评论ID，如果ID不为0，说明这是一条子评论，然后就将邮件发送给父级评论。父级评论的邮箱是来自get_comment()函数获取数据库查询。前面已经说了，对最后一层的回复是<font style="background-color: #ffff00">变相地对倒数第二层进行回复</font>，所以此时邮件全部发送到倒数第二层那里去了。</p>
<p>我注意到上面的问题，来自于一次我在开发自己的ajax评论时对我在最后一层的评论进行回复测试时，结果zww跑来跟我说，收到一大堆我的邮件。我研究了一下，发现存在上述问题，在搁置了N天后，今天我终于解决了它。</p>
<p>这个问题的解决需要换个思路，不能还是局限于通过查询一条评论的父级ID来判断需不需要发送邮件。我注意到我的每条评论中都有@回复链接，而其中的href中就包含了被回复者的评论id，所以我就从这里着手，想通过获取评论中的存在的@回复来进行邮件发送。而且这种方式，你可以一次回复多个人，比如你想在一条评论里同时回复A、B、C三个人，你只需要依次点击A、B、C下面的reply按钮（如果不想让评论框出现在这三人任何一人下方，则点击一下取消回复，评论框会回到底部，这条回复会被当做一条主评论。但是，别担心，评论框内容不会清空，你的回复依然会通过邮件发送至这三人），然后书写回复内容即可。</p>
<p>主要代码如下：</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum1">   1:</span> function comment_mail_notify($comment_id) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum2">   2:</span>     $comment = get_comment($comment_id)<span style="color: #008000">;//根据id获取这条评论相关数据</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum3">   3:</span>     $content = $comment-&gt;<span style="color: #008000">;comment_content;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum4">   4:</span>     //对评论内容进行匹配</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum5">   5:</span>     $match_count=preg_match_all('/&lt;<span style="color: #008000">;a href=&quot;#comment-([0-9]+)?&quot; rel=&quot;nofollow&quot;&gt;/si',$content,$matchs);</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum6">   6:</span>     <span style="color: #0000ff">if</span>($match_count&gt;<span style="color: #008000">;0){//如果匹配到了</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum7">   7:</span>         foreach($matchs[1] as $parent_id){//对每个子匹配都进行邮件发送操作</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum8">   8:</span>             SimPaled_send_email($parent_id,$comment)<span style="color: #008000">;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum9">   9:</span> <span style="color: #008000">        }</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum10">  10:</span>     }<span style="color: #0000ff">elseif</span>($comment-&gt;<span style="color: #008000">;comment_parent!='0'){//以防万一，有人故意删了@回复，还可以通过查找父级评论id来确定邮件发送对象</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum11">  11:</span>         $parent_id=$comment-&gt;<span style="color: #008000">;comment_parent;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum12">  12:</span>         SimPaled_send_email($parent_id,$comment)<span style="color: #008000">;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum13">  13:</span> <span style="color: #008000">    }else return;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum14">  14:</span> }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum15">  15:</span> add_action('comment_post', 'comment_mail_notify')<span style="color: #008000">;</span></pre>
</div>
</div>
<p>然后就是发送邮件的函数，简单给个思路 </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum1">   1:</span> function SimPaled_send_email($parent_id,$comment){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum2">   2:</span>     $admin_email = get_bloginfo ('admin_email')<span style="color: #008000">;//管理员邮箱</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum3">   3:</span>     $parent_comment=get_comment($parent_id)<span style="color: #008000">;//获取被回复人（或叫父级评论）相关信息</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum4">   4:</span>     $author_email=$comment-&gt;<span style="color: #008000">;comment_author_email;//评论人邮箱</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum5">   5:</span>     $<span style="color: #0000ff">to</span> = trim($parent_comment-&gt;<span style="color: #008000">;comment_author_email);//被回复人邮箱</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum6">   6:</span>     $spam_confirmed = $comment-&gt;<span style="color: #008000">;comment_approved;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum7">   7:</span>     <span style="color: #0000ff">if</span> ($spam_confirmed != 'spam' &amp;<span style="color: #008000">;&amp; $to != $admin_email &amp;&amp; $to != $author_email) {</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum8">   8:</span>         ....//自由发挥</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum9">   9:</span>         wp_mail( $<span style="color: #0000ff">to</span>, $subject, $message, $headers )<span style="color: #008000">;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum10">  10:</span> <span style="color: #008000">    }</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum11">  11:</span> }</pre>
</div>
</div>
<p>至此，就完美解决了邮件发送混乱这一问题。你可以在我这里测试，你的任何回复都会准确无误的发送至你要回复的人。</p>
<p>需要注意的是，对评论内容进行匹配@回复相关内容时，你的@回复需要符合上面正则里的规则。我建议，在向评论框里添加@回复时，依照此格式 </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum1">   1:</span> &lt;<span style="color: #008000">;a href=&quot;comment-&quot;$id&gt;@XXX &lt;/a&gt;</span></pre>
</div>
</div>
<p>你不用画蛇添足去往里面添加什么rel=”nofollow”，因为wordpress会自动给评论里的链接添加这一属性。</p>
<p>然后，当然，只以上部分两段代码就完了吗？如果有人引用了另外一条带@回复的评论，是不是也应该先剥离&lt;blockquote&gt;标签内容里的内容呢？否则，被引用人所回复的那个人不是也会被发送一封邮件吗？这些不是本文内容，所以不在此讨论，仅作提醒。 </p>
<hr /><strong>转载注明本文地址,谢谢</strong>。 </p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/07/221.png&amp;h=100&amp;w=100&amp;zc=1" alt="完美解决WordPress嵌套回复的层深问题（无限嵌套）&lt;一&gt;" class="thumb" /><a href="http://www.qiqiboy.com/2010/07/07/perfect-solution-wordpress-nested-layers-deep-back-problems.html" title="完美解决WordPress嵌套回复的层深问题（无限嵌套）&lt;一&gt;">完美解决WordPress嵌套回复的层深问题（无限嵌套）&lt;一&gt;</a> (80)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/renren.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress开发 - 仿淫淫网新鲜事评论的评论列表实现" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html" title="wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现">wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现</a> (46)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/02/312e53cfb85c.gif&amp;h=100&amp;w=100&amp;zc=1" alt="WordPress技术: 无限多级楼层显示" class="thumb" /><a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html" title="WordPress技术: 无限多级楼层显示">WordPress技术: 无限多级楼层显示</a> (61)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/01/PNG-633337.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress评论系统的回复、引用二合一" class="thumb" /><a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html" title="wordpress评论系统的回复、引用二合一">wordpress评论系统的回复、引用二合一</a> (32)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/12/e77406ff9f03.png&amp;h=100&amp;w=100&amp;zc=1" alt="永不丢失的评论 - 打造wordpress评论框的本地化存储方案" class="thumb" /><a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html" title="永不丢失的评论 &#8211; 打造wordpress评论框的本地化存储方案">永不丢失的评论 &#8211; 打造wordpress评论框的本地化存储方案</a> (115)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/7n">http://qiqi.boy.im/7n<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2011年01月18日, <a href="http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html#comment-9638">wisfern</a> say: 正好是我要的功能，有时间再回头研究。</li><li>2010年10月17日, <a href="http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html#comment-7125">WordPress打造无限嵌套评论 | WordPress Of MOPVHS</a> say: [...] @QiQiboy：《完美解决wordpress无限嵌套&lt;二&gt; 【邮件发送相关问题】》 [...]</li><li>2010年09月9日, <a href="http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html#comment-5386">安装VnstatVPS流量监控与伪无限嵌套 | 邪罗刹的菠萝阁</a> say: [...] &gt; 完美解决WordPress嵌套回复的层深问题 - http://www.qiqiboy.com/2010/07/07/erfe...s.html &gt; 完美解决wordpress无限嵌套 - http://www.qiqiboy.com/2010/08/23/perfect-solut..ted-2.html [...]</li><li>2010年09月5日, <a href="http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html#comment-5185">QiQiBoY</a> say: <a href="#comment-5183" rel="nofollow">@zwwooooo </a> 
恩，确实，谢谢提醒哈。</li><li>2010年09月5日, <a href="http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html#comment-5183">zwwooooo</a> say: 折腾了，文章代码有个小错误，第3行代码：$content=comment-&gt;comment_content;少了$</li><li>2010年09月5日, <a href="http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html#comment-5182">QiQiBoY</a> say: <a href="#comment-5179" rel="nofollow">@winy </a> 
嵌套层数足够深，就不会出现邮件发送混乱问题。你的不用改了。
<blockquote>变相地对倒数第二层进行回复，所以此时邮件全部发送到倒数第二层那里去了。</blockquote>这句在我这里是指如果你对第五层进行回复，其实是在对第四层进行回复，所以如果使用wilin原来的邮件回复，就会发送到第四层那个人那里去了。</li><li>2010年09月5日, <a href="http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html#comment-5180">winy</a> say: <a href="#comment-5178" rel="nofollow">@QiQiBoY </a> 
就是这个意思 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_lol.gif' alt=':lol:' class='wp-smiley' /> </li><li>2010年09月5日, <a href="http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html#comment-5179">winy</a> say: <a href="#comment-5177" rel="nofollow">@QiQiBoY </a> 
没说清楚，我的意思是如果嵌套层数足够深，就不会出现<blockquote>变相地对倒数第二层进行回复，所以此时邮件全部发送到倒数第二层那里去了。</blockquote>这种情况了，是不是？</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2010/08/23/perfect-solution-wordpress-unlimited-nested-2.html/feed</wfw:commentRss>
		<slash:comments>83</slash:comments>
		</item>
		<item>
		<title>【原理指导篇】无时不在的评论 侧边栏即时回复功能</title>
		<link>http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html</link>
		<comments>http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html#comments</comments>
		<pubDate>Fri, 13 Aug 2010 10:07:12 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html</guid>
		<description><![CDATA[<p>这个表单插入到页面上你有两种选择，一是预先在页面上输出一个完整的评论表单，如在footer.php处，注意要在&#60;body&#62;标签闭合前，然后设置display:none，使之在页面上隐藏。二是直接将表单以串形式赋值到一个js变量，点击回复后直接在页面中插入。这两种方法各有各的好，我是使用第二种，这种方法·较第一种更好接受参数。</p>

<p>一个完整的大致的表单如下：</p><img style="display: inline" class="wlDisabledImage" title="边栏回复" alt="边栏回复" src="http://www.qiqiboy.com/wp-content/uploads/2010/08/e7eecd6c520f.png" width="321" height="281" />]]></description>
			<content:encoded><![CDATA[<p>在上一篇<a href="http://www.qiqiboy.com/2010/08/10/ajax-version-comment-reply-feature-immediately-sidebar.html">《<strong><u>Ajax版即时侧边栏评论回复功能</u></strong>》中我简单介绍了我最新给博客加入的一个功能，那就是在侧边栏能够即时回复评论。我现在就说一下我的这个功能的一些关键点及相关原理。</a></p>
<h3>1.在评论下插入“回复”按钮</h3>
<p>这个当然是能够直接从后台输出页面时加上最好了。就拿现在最流行的那个带头像最新评论来说，可以在foreach循环输出部分的加入回复按钮。这个按钮包含的动作处理就用“onclick”，所以要在此添加 </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">a</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;rc_comment-reply-link&quot;</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&quot;javascript:void(0)&quot;</span> <span style="color: #ff0000">onclick</span><span style="color: #0000ff">=&quot;rc_reply(arg1,arg2(,...))&quot;</span><span style="color: #0000ff">&gt;</span>回复<span style="color: #0000ff">&lt;/</span><span style="color: #800000">a</span><span style="color: #0000ff">&gt;</span></pre>
</div>
</div>
<p>调用函数rc_reply()中我们要传递进去一些需要的参数，那么需要什么呢？因为点击回复按钮后我们是要在此插入评论的表单，而wordpress的发表评论表单包含用户名（author）、邮箱（email）、网址（url）和评论框（comment），但是除此之外，其实还有两个参数，他们是隐藏的input，分别是评论所在页面ID（comment_post_ID）和嵌套时父级评论ID（comment_parent）。这两个参数是必不可少的，author email url则不是必须的，如要你要实现自动填入cookie中访客相关信息，则可以将这三个也当做参数传递。所以，完整的回复按钮如下 </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum1">   1:</span> &lt;<span style="color: #008000">;a id=&quot;rc_comment-reply-link&quot; href=&quot;javascript:void(0)&quot; onclick=&quot;rc_reply('&lt;?php $comment-&gt;comment_ID ?&gt;', '&lt;?php $comment-&gt;comment_post_ID ?&gt;')&quot;&gt;回复&lt;/a&gt;</span></pre>
</div>
</div>
<p>&#160;</p>
<h3>2.点击回复后在评论下插入评论表单</h3>
<p>这个表单插入到页面上你有两种选择，一是预先在页面上输出一个完整的评论表单，如在footer.php处，注意要在&lt;body&gt;标签闭合前，然后设置display:none，使之在页面上隐藏。二是直接将表单以串形式赋值到一个js变量，点击回复后直接在页面中插入。这两种方法各有各的好，我是使用第二种，这种方法·较第一种更好接受参数。</p>
<p>一个完整的大致的表单如下：</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">div</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;rc_respond&quot;</span><span style="color: #0000ff">&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum2">   2:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">form</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;rc_commentform&quot;</span> <span style="color: #ff0000">method</span><span style="color: #0000ff">=&quot;post&quot;</span> <span style="color: #ff0000">action</span><span style="color: #0000ff">=&quot;http://你的域名/wp-comments-post.php&quot;</span><span style="color: #0000ff">&gt;&lt;!</span><span style="color: #800000">--你的域名最好手写上去</span>，<span style="color: #ff0000">如果使用第一种方法</span>，<span style="color: #ff0000">则可以通过wp的the_bloginfo获取博客地址</span>，<span style="color: #ff0000">使用第二种方法则可用window</span>.<span style="color: #ff0000">location</span>.<span style="color: #ff0000">host等</span>。<span style="color: #ff0000">建议直接写上自己的博客地址--</span><span style="color: #0000ff">&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum3">   3:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">input</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text&quot;</span> <span style="color: #ff0000">tabindex</span><span style="color: #0000ff">=&quot;1&quot;</span> <span style="color: #ff0000">size</span><span style="color: #0000ff">=&quot;22&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;&quot;</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;rc_author&quot;</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;author&quot;</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">label</span> <span style="color: #ff0000">for</span><span style="color: #0000ff">=&quot;author&quot;</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">small</span><span style="color: #0000ff">&gt;</span>Name<span style="color: #0000ff">&lt;/</span><span style="color: #800000">small</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">label</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum4">   4:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">input</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text&quot;</span> <span style="color: #ff0000">aria-required</span><span style="color: #0000ff">=&quot;true&quot;</span> <span style="color: #ff0000">tabindex</span><span style="color: #0000ff">=&quot;2&quot;</span> <span style="color: #ff0000">size</span><span style="color: #0000ff">=&quot;22&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;&quot;</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;rc_email&quot;</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;email&quot;</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">label</span> <span style="color: #ff0000">for</span><span style="color: #0000ff">=&quot;email&quot;</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">small</span><span style="color: #0000ff">&gt;</span>Mail<span style="color: #0000ff">&lt;/</span><span style="color: #800000">small</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">label</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum5">   5:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">input</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;text&quot;</span> <span style="color: #ff0000">tabindex</span><span style="color: #0000ff">=&quot;3&quot;</span> <span style="color: #ff0000">size</span><span style="color: #0000ff">=&quot;22&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;'&quot;</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;rc_url&quot;</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;url&quot;</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">label</span> <span style="color: #ff0000">for</span><span style="color: #0000ff">=&quot;url&quot;</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">small</span><span style="color: #0000ff">&gt;</span>Website<span style="color: #0000ff">&lt;/</span><span style="color: #800000">small</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">label</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum6">   6:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">textarea</span> <span style="color: #ff0000">tabindex</span><span style="color: #0000ff">=&quot;4&quot;</span> <span style="color: #ff0000">rows</span><span style="color: #0000ff">=&quot;5&quot;</span> <span style="color: #ff0000">cols</span><span style="color: #0000ff">=&quot;35&quot;</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;rc_comment&quot;</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;comment&quot;</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">textarea</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum7">   7:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">input</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;submit&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;Submit&quot;</span> <span style="color: #ff0000">tabindex</span><span style="color: #0000ff">=&quot;5&quot;</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;rc_submit&quot;</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;submit&quot;</span><span style="color: #0000ff">&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum8">   8:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">input</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;hidden&quot;</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;rc_comment_post_ID&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;'&quot;</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;comment_post_ID&quot;</span><span style="color: #0000ff">&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum9">   9:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">input</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;hidden&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;&quot;</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;rc_comment_parent&quot;</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;comment_parent&quot;</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum10">  10:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">form</span><span style="color: #0000ff">&gt;</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum11">  11:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">div</span><span style="color: #0000ff">&gt;</span></pre>
</div>
</div>
<p>使用第种方法你就将这个表单所在的div#rc_respond加上style=”displaynone“。如果是使用第二种方法，则可以在js中将这个变成字符串形式交给一个变量。</p>
<p><span id="more-2468"></span></p>
<h3>3.相关JS处理部分</h3>
<p>本来想要贴一段代码的，但是后来发现这段代码和具体的页面结构结合很深。由于大家的模板千变万化，所以直接贴出某一具体的代码很可能会误导一些人，所以我就说一下JS里需要处理的部分。首先是要将表单插入到正确的位置，如果你的表单预先输出在页面上，此时就可以使用结点操作将表单移动到需要的位置（如js的appendChild、insertBefore等，以及jQuery的一些结点操作）；如果你的表单还是一窜字符串存在js变量里，则可用innerHTML方式写入到页面的位置上或者是jQuery的html()方法。当然，最重要的是向表单中的comment_post_ID和comment_parent=中填入相关参数，这两个参数值已经是作为函数的参数传递进来了，只需要将值填入即可。</p>
<h3>4.解决嵌套问题</h3>
<p>边栏的最新评论你并不知道是不是最后一层回复了，即使知道，我们也要想办法能够对其进行回复。如果不对嵌套做相关处理，如果是最后一层评论，你即使回复了，也是无效的，仍然会被当做主评论显示。所以我们要知道一条评论目前的所在层深。怎么取得呢？我们可以循环查询数据库中一条评论表中的commet_parent键值，如果不为0，则说明他有父级评论，则再去查询它的父级评论的comment_parent键值，依次循环。</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum1">   1:</span> <span style="color: #008000">//这段代码依然是加在后台foreach循环中</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum2">   2:</span> $comment_depth = 1;<span style="color: #008000">//层深初始化为1</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum3">   3:</span> $tmp_c = $comment;$comment_parent</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum4">   4:</span> <span style="color: #0000ff">while</span>($tmp_c-&gt;;comment_parent != 0){<span style="color: #008000">//循环查询</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum5">   5:</span>     $comment_depth++;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum6">   6:</span>     $tmp_c = get_comment($tmp_c-&gt;comment_parent);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum7">   7:</span> }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum8">   8:</span> <span style="color: #008000">//关键处，这里依然是用了父级ID替换方法，将对最后一层的回复替换为对倒数第二层的回复</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum9">   9:</span> <span style="color: #0000ff">if</span>($comment_depth &lt;; get_option(<span style="color: #006080">'thread_comments_depth'</span>))</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum10">  10:</span>     $comment_parent=$comment-&gt;;comment_ID;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="padding-bottom: 1px; padding-left: 1px; padding-right: 1px; background: #f4f4f4; color: #606060; margin-left: -1em; padding-top: 1px" id="lnum11">  11:</span> <span style="color: #0000ff">else</span> $comment_parent=get_comment($comment-&gt;;comment_parent)-&gt;comment_ID;</pre>
</div>
</div>
<p>然后你就可以用$comment_parent去替换第一步中的$comment-&gt;comment_ID。<br />
  </p>
<p>做完以上四步，基本上边栏回复的雏形就完成了。当然，此时你回复后点击提交会跳转刷新页面，并不是ajax方式，其实这个也简单，你甚至可以照搬你文章评论处的ajax提交方式，只需改改相关id值即可。</p>
<p>OK，具体中有什么问题还可以留言询问，我尽量解决。</p>
<p>&#160;<img style="display: inline" class="wlDisabledImage" title="边栏回复" alt="边栏回复" src="http://www.qiqiboy.com/wp-content/uploads/2010/04f81548e0d5_ED6C/aaf4bbb60650.png" width="321" height="281" /></p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/1d7a79196621_DAE1/434.png&amp;h=100&amp;w=100&amp;zc=1" alt="仿腾讯微博式访客信息悬浮显示（JavaScript &amp; ajax）" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/16/visitor-information-tencent-suspended-micro-display.html" title="仿腾讯微博式访客信息悬浮显示（JavaScript &amp; ajax）">仿腾讯微博式访客信息悬浮显示（JavaScript &amp; ajax）</a> (107)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/07/b3b47b6400e6.png&amp;h=100&amp;w=100&amp;zc=1" alt="添加引用按钮&mdash;&mdash;轻松打造属于你的WordPress引用回复功能" class="thumb" /><a href="http://www.qiqiboy.com/2010/07/15/easily-create-your-own-wordpress-quote-reply-function.html" title="添加引用按钮&mdash;&mdash;轻松打造属于你的WordPress引用回复功能">添加引用按钮&mdash;&mdash;轻松打造属于你的WordPress引用回复功能</a> (32)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/02/312e53cfb85c.gif&amp;h=100&amp;w=100&amp;zc=1" alt="WordPress技术: 无限多级楼层显示" class="thumb" /><a href="http://www.qiqiboy.com/2011/02/02/unlimited-multi-level-floor-display.html" title="WordPress技术: 无限多级楼层显示">WordPress技术: 无限多级楼层显示</a> (61)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/01/PNG-633337.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress评论系统的回复、引用二合一" class="thumb" /><a href="http://www.qiqiboy.com/2011/01/17/wordpress-reply-and-quote.html" title="wordpress评论系统的回复、引用二合一">wordpress评论系统的回复、引用二合一</a> (32)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/12/e77406ff9f03.png&amp;h=100&amp;w=100&amp;zc=1" alt="永不丢失的评论 - 打造wordpress评论框的本地化存储方案" class="thumb" /><a href="http://www.qiqiboy.com/2010/12/11/comments-will-never-be-lost.html" title="永不丢失的评论 &#8211; 打造wordpress评论框的本地化存储方案">永不丢失的评论 &#8211; 打造wordpress评论框的本地化存储方案</a> (115)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/76">http://qiqi.boy.im/76<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2011年03月30日, <a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html#comment-10445">颠覆你的wordpress体验-ajaxPaled(全站ajax，杂志型布局) &#124; 忘川彼岸</a> say: [...] 【原理指导篇】无时不在的评论 侧边栏即时回复功能 (24)这个表单插入到页面上你有两种选择，一是预先在页面上输出一个完整的评论表单，如在footer.php处，注意要在&lt;body&gt;标签闭合前，然后设置display:none，使之在页面上隐藏。二是直接&#8230; [...]</li><li>2010年08月16日, <a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html#comment-4244">【SimPaled篇】Introduce My Blog Theme For You - I'm qiqiboy !</a> say: [...] 边栏的最新评论支持翻页浏览、单条评论查看、即时ajax回复等功能。其中最新文章(recent post)部分支持more无限下滚查看。——注：边栏回复参考《无时不在的评论 侧边栏即时回复功能》 [...]</li><li>2010年08月15日, <a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html#comment-4223">超人</a> say: <a href="#comment-4221" rel="nofollow">@QiQiBoY </a> 
哈哈。。你在ad</li><li>2010年08月15日, <a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html#comment-4221">QiQiBoY</a> say: <a href="#comment-4218" rel="nofollow">@超人</a>
额。。我试用后觉得很方便的功能。。
有了这个，我回复你这三条不在一个页面的评论，在侧边栏不用翻页就可以全部回复了。。</li><li>2010年08月15日, <a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html#comment-4218">超人</a> say: 这功能有点奢侈了。。 基本用不上啦~</li><li>2010年08月15日, <a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html#comment-4207">小邪</a> say: <a href="#comment-4103" rel="nofollow">@liuqiqi </a> 
拖出去切JJ ~  <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_cool.gif' alt=':cool:' class='wp-smiley' /> </li><li>2010年08月14日, <a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html#comment-4158">江流</a> say: 这个挺实用的 不过我不折腾了- -</li><li>2010年08月14日, <a href="http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html#comment-4136">QiQiBoY</a> say: <a href="#comment-4133" rel="nofollow">@Alan </a> 
哈哈，无折腾，不WP。。。</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2010/08/13/ever-present-sidebar-instant-recovery-capabilities-comments.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>

