查看: 9|回复: 0

[教程] z-blog评论留言的引用按钮写法详解

[复制链接]

4

主题

0

回帖

0

积分

热心网友

金币
0
阅读权限
220
精华
0
威望
0
贡献
0
在线时间
0 小时
注册时间
2010-9-22
发表于 2009-6-6 15:43:16 | 显示全部楼层 |阅读模式
关键字描述:详解 按钮 引用 评论 留言 < " > class .innerHTML

z-blog默认主题的模板b_article_comment.html中

<ul class="msg">

    <li class="msgname"><span class="comment-quote-icon"><a onclick="InsertQuote(this.parentNode.parentNode.parentNode.getElementsByTagName('a')[2].innerHTML,this.parentNode.parentNode.parentNode.getElementsByTagName('li')[2].innerHTML);return false;" href=""><img src="<#ZC_BLOG_HOST#>image/common/quote.gif" height="9" width="9" alt="quote" title="quote" /></a></span>&nbsp;<a name="cmt<#article/comment/id#>"><#article/comment/count#></a>.<a><#article/comment/name#></a></li>

    <li class="msgurl"><a href="<#article/comment/urlencoder#>" rel="nofollow" target="_blank"><#article/comment/url#></a></li>

    <li class="msgarticle"><#article/comment/content#></li>

    <li class="msgtime"><#article/comment/posttime#>&nbsp;<a href="#comment" onclick="RevertComment('<#article/comment/id#>')"><#ZC_MSG265#></a></li>

</ul>

要把其格式改成如下结构,z-blog引用评论的按钮要如何写呢?:

<div class="msg">

<cite>评论者</cite>

<blockquote>评论内容</blockquote>

<p>网站</p>

<p>时间</p>

</div>
  • 讲解z-blog引用所用的JS函数:
    1. 引用的函数: InsertQuote(参数1[评论者],参数2[评论内容])
    2. this.parentNode 表示该节点的上一节点
    3. getElementsByTagName('a')[2].innerHTML 表示获取第二个<a>元素的内容,即<#article/comment/name#>
    4. 同上,getElementsByTagName('li')[2].innerHTML 为<#article/comment/content#>

    修改后的代码

    <div class="msg">
    
    <a onclick="InsertQuote(this.parentNode.getElementsByTagName('CITE')[0].innerHTML,this.parentNode.getElementsByTagName('BLOCKQUOTE')[0].innerHTML);return false;" href="#comment">引用</a>
    
    <cite>评论者</cite>
    
    <blockquote>评论内容</blockquote>
    
    <p>网站</p>
    
    <p>时间</p>
    
    </div>

  • 回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

    Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

    在本版发帖返回顶部