主题:  留言版UBB代码挂上,到46行出错,谁帮看下

xiaoQQ

职务:普通成员
等级:1
金币:-2.0
发贴:62
#12006/2/8 0:10:26
<%
Function ubbcode(str)
Dim re
Set re = New RegExp
re.IgnoreCase = true

str = Server.HTMLEncode(str)
str = Replace(str," ","&nbsp;"
str = Replace(str,Chr(10),"<br>"

re.Pattern="\[IMG\](http|https|ftp);\/\/(.^\[]*)\[\/IMG\]"
str= re.Replace(str,"<img src=""$1;//$2"" alt=""单击在新窗口浏览图片"" onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></a>"

re.Pattern="(\[URL\])(.[^\[]*)(\[\/URL\])"
str= re.Replace(str,"<a target=_blank href=""$2"">$2</a>"

re.Pattern="(\[URL=(.[^\[]*)\])(.[^\[]*)(\/URL\])"
str= re.Replace(str,"<a target=_blank href=""$2"">$3</a>"

re.Pattern="(\[EMAIL\])(\s+\@.[^\[]*)(\[\/EMAIL\])"
str= re.Replace(str,"<a href=""mailto:$2"">$2</a>"

re.Pattern = "^((http|https|ftp|rtsp|mms);(\/\/|\\\\)[A-Za-z0-9\./=\?%\-&_~`@[\]\';+!]+)"
srt = re.Replace(str,"<a target=_blank href=$1>$1</a>"

re.Pattern="\[size=([1-4])\](.[^\[]*)\[\/size\]"
srt=re.Replace(str,"<font size=$1>$2</font>"

re.Pattern="\[color=(.[^\[]*)\](.[^\[])*\[\/color\]"
str=re.replace(str,"<font color=$1>$2</font>"

re.Pattern="\[face=(.[^\[]*)\](.[^\[]*)\[\/face\]"
str=re.Replace(str,"<font face=$1>$2</font>"

str=quote(str)

str=runcode(str)

Set re=Nothing
ubbcode = str
End Function
%>
<script language="JScript" RUNAT="SERVER">
var qre=/\[quote\](.*)\[\/quote\]/gi
function quote(code){
code=code.replace(qre,funciton (code){Return Quote(code.replace(qre,"<div style="\margin:5px;width:90%;border:1px solid
#333333;backgroud-color:#eeeeee;padding:5px\">$1</div>")})
return code
}
function runcode(code){
code=code.replace(/\[?!html\]|run\]|\/html\]|\/run\])/gi,"&#91;"
code=code.replace(/\[html|run)\](.[^\[]*)\[\/(html|run)\]/gi,function($0,$1,$2){
$2=$2.replace(/<br>/gi,"\n"
$2=$2.replace(/\&nbsp;/gi,""
$2=$2.replace(/<a target=blank href=((http|https|ftp|rtsp|mms);(\/\/|\\\\)[A-Za-z0-9\./=\?%\-&_~`@[\]\';+!]+)>
((http|https|ftp|rtsp|mms);(\/\/|\\\\)[A-Za-z0-9\./=\?%-&_~`@[\]\';+)<\/a>/gi,$4)
return "<div><textarea style=\"width;98%;htight;200\">"+$2+"</textarea><br><input type=button value="运行代码
onclick='runCode()'> <INPUT onclock='copyCode()' type=button value=复制代码></div>"})
return code
}
</script>
这个UBB代码是支持留言版可以打空格跟换行,按书本打的,可到46行出错,对了好几百变没办法,还是不行,那个高人帮忙看下,谢谢~



缺缺

职务:管理员
等级:8
金币:41.0
发贴:9620
#22006/2/8 14:40:38
46行是哪行



xiaoQQ

职务:普通成员
等级:1
金币:-2.0
发贴:62
#32006/2/8 17:18:23
你复到DW看不就知道了