论坛,引用功能

<style>
.q{border:1px solid gray;padding:0}
.q div{font-size:12px}
.q_t{padding:4px;background-color:#ffffe1;border-bottom:1px solid gray}
.q_c{padding:4px 4px 4px 12px}
#txt,#show{width:700px;border:1px solid navy;padding:4px}
#txt{height:220px;font:normal 11px "courier new"}
</style>

在这里将[Quote][/Quote]替换掉
<script>
function ubbQuote(str){
  return str.replace(//[quote/]([/s/S]+)/[//quote/]/g,function(s0,s){
   return "<div class=q><div class=q_t>引用内容:</div><div class=q_c>"+
     ubbQuote(s)+"</div></div>";
  });
}
function test(){
  $("show").innerHTML=ubbQuote($("txt").value);
}
function $(id){
  return document.getElementById(id);
}
</script>
<textarea id=txt>[quote]Hello[quote]Hello world[quote][quote]Hello world[/quote]Hello world[/quote][/quote] world[/quote]</textarea><br>
<input type=button value=test οnclick=test()><br>
<div id=show></div>

<span οnclick="javascript:try{Quote('<%#DataBinder.Eval(Container.DataItem,"dt_CommentDate")%>','<%#DataBinder.Eval(Container.DataItem,"dt_CommentDate")%>',0)}catch(ex){};return false">引用</span> 

 

先写这么多,原文来自http://bbs.blueidea.com/thread-2750169-1-1.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值