UBB文件严重问题,大家都进来看看!
ubb.asp的代码如下:<%
Function ubbcode(str)
Dim re '建立变量
Set re = New RegExp '建立正则表达式
re.IgnoreCase = true '设置是否区分大小写
str = Server.HTMLEncode(str) '屏蔽HTML代码
str = Replace(str," "," ") '替换空格
str = Replace(str,Chr(10),"<br>") '替换回车符
re.Pattern="\[IMG\](http|https|ftp):\/\/(.[^\[]*)\[\/IMG\]" '图片模板的匹配与替换
str=re.Replace(str,"<img src=""$1://$2"" alt=""单击在新窗口浏览图片"" onload=""this.width=Math.min(this.width,screen.width-300)"" onClick=""window.open(this.src)"">")
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\])" ' Email 链接模板的匹配与替换
str= re.Replace(str,"<a href=""mailto:$2"">$2</a>")
re.Pattern = "^((http|https|ftp|rtsp|mms):(\/\/|\\\\)[A-Za-z0-9\./=\?%\-&_~`@[\]\':+!]+)" '自动识别网址,并进行模板替换
str = re.Replace(str,"<a target=_blank href=$1>$1</a>")
re.Pattern="\[size=([1-4])\](.[^\[]*)\[\/size\]" '文字大小模板的匹配与替换
str=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 '返回 str
End Function
%>
<script language="JScript" runat="server">
var qre=/\[quote\](.*)\[\/quote\]/gi
function quote(code){
code=code.replace(qre,function (code){return quote(code.replace(qre,"<div style=\"margin:5px;width:90%;border:1px solid #333333;background-color:#eeeeee;padding:5px\">$1</div>"))})
return code
}
function runcode(code){
code=code.replace(/\[(?!html\]|run\]|\/html\]|\/run\])/gi,"[")
code=code.replace(/\[(html|run)\](.[^\[]*)\[\/(html|run)\]/gi,function ($0,$1,$2){
$2=$2.replace(/<br>/gi,"\n")
$2=$2.replace(/\ /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%;height:200\">"+$2+"</textarea><br><input type=button value=运行代码 onclick='runCode()'> <INPUT onclick='copyCode()' type=button value=复制代码></div>"})
return code
}
</script>
我的是个留言本,应用了ubb代码,可是浏览我的留言本就是打不开,老是出现
Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft JScript 编译错误 错误 '800a139a'
错误的数量词
/guestbook/ubb.asp,行51
code=code.replace(/\[(?!html\]|run\]|\/html\]|\/run\])/gi,"[")
----------------------^
我也看不明白,请大家帮我看看那里错了,请高手帮我修改一下,谢谢了,!