htmlubb.asp

来自「学校部门网站设计,里面有好多模块譬如 简介联系方式 登陆注册留言新闻发布」· ASP 代码 · 共 67 行

ASP
67 行
字号
<%
function UBBCode(strContent)	
	dim re
	Set re=new RegExp
	re.IgnoreCase =true
	re.Global=True
	
	strContent=HTMLcode(strContent)

	re.Pattern="(\[IMG\])(http://.[^\[]*)(\[\/IMG\])"
	strContent=re.Replace(strContent,"<A HREF=""$2"" TARGET=_blank><IMG SRC=""$2"" border=0 alt=按此在新窗口浏览图片 onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></A>")
			
	re.Pattern="(\[IMG\])(.[^\[]*)(\[\/IMG\])"
	strContent=re.Replace(strContent,"<A HREF=""$2"" TARGET=_blank><IMG SRC=""$2"" border=0 alt=按此在新窗口浏览图片 onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></A>")
	
	re.Pattern="(\[URL\])(.[^\[]*)(\[\/URL\])"
	strContent= re.Replace(strContent,"<img align=absmiddle src=images/yurl.gif><A HREF=""$2"" TARGET=_blank>$2</A>")
	re.Pattern="(\[URL=(.[^\[]*)\])(.[^\[]*)(\[\/URL\])"
	strContent= re.Replace(strContent,"<img align=absmiddle src=images/yurl.gif><A HREF=""$2"" TARGET=_blank>$3</A>")

	re.Pattern="(\[EMAIL\])(.[^\[]*)(\[\/EMAIL\])"
	strContent= re.Replace(strContent,"<img align=absmiddle src=images/yemail.gif><A HREF=""mailto:$2"">$2</A>")
	re.Pattern="(\[EMAIL=(.[^\[]*)\])(.[^\[]*)(\[\/EMAIL\])"
	strContent= re.Replace(strContent,"<img align=absmiddle src=images/yemail.gif><A HREF=""mailto:$2"" TARGET=_blank>$3</A>")

	re.Pattern="(\[color=(.[^\[]*)\])(.[^\[]*)(\[\/color\])"
	strContent=re.Replace(strContent,"<font color=$2 style=""font-size:"&FontSize&"pt;line-height:"&FontHeight&"pt"">$3</font>")
	re.Pattern="(\[face=(.[^\[]*)\])(.[^\[]*)(\[\/face\])"
	strContent=re.Replace(strContent,"<font face=$2 style=""font-size:"&FontSize&"pt;line-height:"&FontHeight&"pt"">$3</font>")
	re.Pattern="(\[align=(.[^\[]*)\])(.*)(\[\/align\])"
	strContent=re.Replace(strContent,"<div align=$2>$3</div>")

	
	re.Pattern="(\[i\])(.[^\[]*)(\[\/i\])"
	strContent=re.Replace(strContent,"<i>$2</i>")
	re.Pattern="(\[u\])(.[^\[]*)(\[\/u\])"
	strContent=re.Replace(strContent,"<u>$2</u>")
	re.Pattern="(\[b\])(.[^\[]*)(\[\/b\])"
	strContent=re.Replace(strContent,"<b>$2</b>")

	re.Pattern="(\[size=1\])(.[^\[]*)(\[\/size\])"
	strContent=re.Replace(strContent,"<font size=1 style=""line-height:"&FontHeight&"pt"">$2</font>")
	re.Pattern="(\[size=2\])(.[^\[]*)(\[\/size\])"
	strContent=re.Replace(strContent,"<font size=2 style=""line-height:"&FontHeight&"pt"">$2</font>")
	re.Pattern="(\[size=3\])(.[^\[]*)(\[\/size\])"
	strContent=re.Replace(strContent,"<font size=3 style=""line-height:"&FontHeight&"pt"">$2</font>")
	re.Pattern="(\[size=4\])(.[^\[]*)(\[\/size\])"
	strContent=re.Replace(strContent,"<font size=4 style=""line-height:"&FontHeight&"pt"">$2</font>")

	re.Pattern="(\[center\])(.[^\[]*)(\[\/center\])"
	strContent=re.Replace(strContent,"<center>$2</center>")

	set re=Nothing
	UBBCode=strContent
end function

function HTMLcode(fString)
if not isnull(fString) then
		fString = Replace(fString, CHR(13), " ")
		fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
		fString = Replace(fString, CHR(10), "<BR>")
		fString = Replace(fString, CHR(32)&CHR(32), "&nbsp;&nbsp;")
		fString = Replace(fString, CHR(9)&CHR(9), "&nbsp;")
		HTMLcode = fString
		end if
end function
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?