首页| 新闻| 娱乐| 游戏| 科普| 文学| 编程| 系统| 数据库| 建站| 学院| 产品| 网管| 维修| 办公| 热点
ubb代码对于经常上论坛的朋友来说是最熟悉不过了。经典论坛的ubb转换我觉得是处理的非常好的,研究了一下它的转换结果[因为没有源码:)],做了下面的演示。转换结果基本上觉得象了。
主要是针对[code][html]这两个标签的处理,其他的ubb标签还是一般的处理方法。
下面是分别用javascript和vbscript实现的演示。自己做论坛的朋友,假如想实现类似经典论坛的运行代码框可以看看这种转换。
欢迎大家输入尽量多格式的ubb进行测试,多多指出错误。
javascript:
<style>.codesamp { padding-right: 0.5em; margin-top: 1em; padding-left: 0.5em; font-size: 8p; margin-bottom: 1em; padding-bottom: 0.5em; margin-left: 0pt; padding-top: 0.5em; font-family: "courier new"; background-color: #eeeeee;width: 480px;overflow:hidden;border: 1px solid #888888;}textarea {border-width: 1; border-color: #000000;font-size: 12px;font-family: "tahoma", "ms shell dlg";}</style>
<textarea name=phx cols=65 rows=12>[i][b][color=blue]blue[/color][/b][/i]
[html][color=red]test[/color][/html]
[html][code]test[/code][/html]
[code][html]test[/html][/code]</textarea><br><button onclick=show.innerhtml=ubbcode(phx.value,"html")>转换</button><br><div id=show style="border:1 solid skyblue;width=500;font-size: 12px;font-family: 'tahoma', 'ms shell dlg';"></div>
<script>stricons = "1" //答应笑脸转换strsmile="1" //同上imgname="em"picurl="pic/"
function ubbcode(content,html){st=new date().gettime()content=content.replace(//[(//)?phx_code/]/ig,"{$1phx_code}");content=content.replace(//[(//)?phx_html/]/ig,"{$1phx_html}");content="[phx_code]" content "[/phx_code]"; content=content.replace(/(/[code/]([/s/s] ?)/[//code/])/ig,"[/phx_code]$1[phx_code]");content=content.replace(//[phx_code/]([/s/s]*?)/[//phx_code/]/ig,function($1,$2){if(html=="html"){return(htmlcode($2));}else{return(trans($2));}});content=content.replace(//[code/](/r/n)?([/s/s] ?)/[//code/]/ig,function($1,$2,$3){return("<pre class=codesamp>" dvbbshtmlan($3) "</pre>")});content=content.replace(//{(//)?phx_code/}/ig,"[$1phx_code]");content=content.replace(//{(//)?phx_html/}/ig,"[$1phx_html]");alert('共耗时 ' eval(new date().gettime()-st) ' ms');return(content);}
function htmlcode(content){ content="[phx_html]" content "[/phx_html]"; content=content.replace(/(/[html/]([/s/s] ?)/[//html/])/ig,"[/phx_html]$1[phx_html]");content=content.replace(//[phx_html/]([/s/s]*?)/[//phx_html/]/ig,function($1,$2){return(trans($2))});content=content.replace(//[html/]([/s/s] ?)/[//html/]/ig,function($1,$2){return("<span><textarea cols=95 rows=12>" hencode($2) "</textarea><br><input onclick=runcode() type=button value=运行代码>[ctrl a 全部选择 提示:你可先修改部分代码,再按运行]</span>")});return(content);|||}
function hencode(fstring){ //简单模拟server.htmlencode asp中不用这个 fstring = fstring.replace(/&/ig,"&") fstring = fstring.replace(/>/ig,">") //> fstring = fstring.replace(/</ig,"<") //<return fstring;}
function dvbbshtmlan(fstring){
if(fstring=="")return("");
fstring=hencode(fstring)
fstring = fstring.replace(//t/ig," ") //tab fstring = fstring.replace(/"/ig,""") //" fstring = fstring.replace(/'/ig,"'") //' fstring = fstring.replace(//r/ig,"") //回车是一个13 10 fstring = fstring.replace(//n/n/ig,"<p>") // fstring = fstring.replace(//n/ig,"<br>") //换行 fstring = fstring.replace(//x20/ig," ") //空格
return(fstring);}
function trans(strcontent){var re;strcontent=dvbbshtmlan(strcontent); re=//[img/](. ?)/[//img/]/ig; strcontent=strcontent.replace(re,"<a href=$1 target=_blank><img src=$1 border=0 alt=按此在新窗口浏览图片 this.width=screen.width-333/" galleryimg=no></a>"); re=//[dir=*([0-9]*),*([0-9]*)/](.*?)/[//dir]/ig strcontent=strcontent.replace(re,"<object classid=clsid:166b1bca-3f9c-11cf-8075-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0 width=$1 height=$2><param name=src value=$3><embed src=$3 pluginspage=http://www.macromedia.com/shockwave/download/ width=$1 height=$2></embed></object>") re=//[qt=*([0-9]*),*([0-9]*)/](.*?)/[//qt]/ig strcontent=strcontent.replace(re,"<embed src=$3 width=$1 height=$2 autoplay=true loop=false controller=true playeveryframe=false cache=false scale=tofit bgcolor=#000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/quicktime/>") re=//[mp=*([0-9]*),*([0-9]*)/](.*?)/[//mp]/ig strcontent=strcontent.replace(re,"<object align=middle classid=clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=object id=mediaplayer width=$1 height=$2 ><param name=showstatusbar value=-1><param name=filename value=$3><embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701 flename=mp src=$3 width=$1 height=$2></embed></object>") re=//[rm=*([0-9]*),*([0-9]*)/](.*?)/[//rm]/ig strcontent=strcontent.replace(re,"<object classid=clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa class=object id=raocx width=$1 height=$2><param name=src value=$3><param name=console value=clip1><param name=controls value=imagewindow><param name=autostart value=true></object><br><object classid=clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa height=32 id=video2 width=$1><param name=src value=$3><param name=autostart value=-1><param name=controls value=controlpanel><param name=console value=clip1></object>")|||
re=/(/[flash/])(.*?)(/[//flash/])/ig strcontent= strcontent.replace(re,"<object codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=500 height=400><param name=movie value=$2><param name=quality value=high><embed src=$2 quality=high pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width=500 height=400>$2</embed></object>") re=/(/[flash=*([0-9]*),*([0-9]*)/])(.*?)(/[//flash/])/ig strcontent= strcontent.replace(re,"<a href=$4 target=_blank><img src=pic/swf.gif border=0 alt=点击开新窗口欣赏该flash动画!> [全屏欣赏]</a><br><br><object codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=$2 height=$3><param name=movie value=$4><param name=quality value=high><param name=menu value=false><embed src=$4 quality=high menu=false pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width=$2 height=$3>$4</embed></object>")
re=/(/[upload=gif/])(.*?)(/[//upload/])/ig strcontent= strcontent.replace(re,"<br><img src=" picurl "gif.gif border=0>此主题相关图片如下:<br><a href=$2 target=_blank><img src=$2 border=0 alt=按此在新窗口浏览图片 this.width=screen.width-333/"></a>") re=/(/[upload=jpg/])(.*?)(/[//upload/])/ig strcontent= strcontent.replace(re,"<br><img src=" picurl "jpg.gif border=0>此主题相关图片如下:<br><a href=$2 target=_blank><img src=$2 border=0 alt=按此在新窗口浏览图片 this.width=screen.width-333/"></a>") re=/(/[upload=bmp/])(.*?)(/[//upload/])/ig strcontent= strcontent.replace(re,"<br><img src=" picurl "bmp.gif border=0>此主题相关图片如下:<br><a href=$2 target=_blank><img src=$2 border=0 alt=按此在新窗口浏览图片 this.width=screen.width-333/"></a>")
re=/(/[upload=(.[^/*)/])(.*?)(/[//upload/])/ig strcontent= strcontent.replace(re,"<br><img src=" picurl "$2.gif border=0> <a href=$3>点击浏览该文件</a>")
re=/(/[url/])(.*?)(/[//url/])/ig strcontent= strcontent.replace(re,"<a href=$2 target=_blank>$2</a>") re=/(/[url=(.[^/*)/])(.*?)(/[//url/])/ig strcontent= strcontent.replace(re,"<a href=$2 target=_blank>$3</a>")
re=/(/[email/])(.*?)(/[//email/])/ig strcontent= strcontent.replace(re,"<img align=absmiddle src=pic/email1.gif><a href=/"$2mailto:$2/">$2</a>") re=/(/[email=(.[^/*)/])(.*?)(/[//email/])/ig strcontent= strcontent.replace(re,"<img align=absmiddle src=pic/email1.gif><a href=/"|||mailto:$2/" target=_blank>$3</a>")
re =/^(http:////[a-za-z0-9/.//=/?%/-&_~`@': !] )/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/(http:////[a-za-z0-9/.//=/?%/-&_~`@': !] )$/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/[^>=""](http:////[a-za-z0-9/.//=/?%/-&_~`@': !] )/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/^(ftp:////[a-za-z0-9/.//=/?%/-&_~`@': !] )/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/(ftp:////[a-za-z0-9/.//=/?%/-&_~`@': !] )$/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/[^>=""](ftp:////[a-za-z0-9/.//=/?%/-&_~`@': !] )/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/^(rtsp:////[a-za-z0-9/.//=/?%/-&_~`@': !] )/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/(rtsp:////[a-za-z0-9/.//=/?%/-&_~`@': !] )$/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/[^>=""](rtsp:////[a-za-z0-9/.//=/?%/-&_~`@': !] )/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/^(mms:////[a-za-z0-9/.//=/?%/-&_~`@': !] )/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/(mms:////[a-za-z0-9/.//=/?%/-&_~`@': !] )$/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re =/[^>=""](mms:////[a-za-z0-9/.//=/?%/-&_~`@': !] )/ig strcontent = strcontent.replace(re,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
if(stricons == "1"){ //笑脸转换 re=/(/[em(.*?)/])/ig strcontent=strcontent.replace(re,"<img src=" picurl imgname "$2.gif border=0 align=middle>") }
if(strsmile == "1"){ //笑脸转换 re=/(/[s(/d{1,2})/])/ig strcontent=strcontent.replace(re,"<img src=smile/face$2.gif border=0 align=middle>") }
re=/(/[color=(.[^/*)/])(.*?)(/[//color/])/ig strcontent=strcontent.replace(re,"<font color=$2>$3</font>") re=/(/[face=(.[^/*)/])(.*?)(/[//face/])/ig strcontent=strcontent.replace(re,"<font face=$2>$3</font>") re=/(/[align=(.[^/*)/])(.*?)(/[//align/])/ig strcontent=strcontent.replace(re,"<div align=$2>$3</div>")|||//循环转换quote re=/(/[quote/])(.*?)(/[//quote/])/ig while(strcontent.indexof("[quote]")>0 && strcontent.indexof("[/quote] ")>0){ strcontent=strcontent.replace(re,"<blockquote>引用:<hr><span>$2</span><hr></blockquote>") } re=/(/[fly/])(.*?)(/[//fly/])/ig strcontent=strcontent.replace(re,"<marquee width=90% behavior=alternate scrollamount=3>$2</marquee>") re=/(/[move/])(.*?)(/[//move/])/ig strcontent=strcontent.replace(re,"<marquee scrollamount=3>$2</marquee>") re=//[glow=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)/](.*?)/[//glow]/ig strcontent=strcontent.replace(re,"<table width=$1 style=/"filter:glow(color=$2, strength=$3)/">$4</table>") re=//[shadow=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)/](.*?)/[//shadow]/ig strcontent=strcontent.replace(re,"<table width=$1 style=/"filter:shadow(color=$2, strength=$3)/">$4</table>")
re=/(/[i/])(.*?)(/[//i/])/ig strcontent=strcontent.replace(re,"<i>$2</i>") re=/(/[u/])(.*?)(/[//u/])/ig strcontent=strcontent.replace(re,"<u>$2</u>") re=/(/[b/])(.*?)(/[//b/])/ig strcontent=strcontent.replace(re,"<b>$2</b>")
re=/(/[size=1/])(.*?)(/[//size/])/ig strcontent=strcontent.replace(re,"<font size=1>$2</font>") re=/(/[size=2/])(.*?)(/[//size/])/ig strcontent=strcontent.replace(re,"<font size=2>$2</font>") re=/(/[size=3/])(.*?)(/[//size/])/ig strcontent=strcontent.replace(re,"<font size=5>$2</font>") re=/(/[size=4/])(.*?)(/[//size/])/ig strcontent=strcontent.replace(re,"<font size=6>$2</font>") re=//[size=([ |-]?[0-7])/](.*?)(/[//size/])/ig strcontent=strcontent.replace(re,"<font size=$1>$2</font>") re=/(/[list/])(. ?)(/[//list/])/ig; strcontent=strcontent.replace(re,"<ul type=square>$2<//ul>"); re=/(/[list=)(a|1)(/])(. ?)(/[//list/])/ig; strcontent=strcontent.replace(re,"<ol type=$2>$4<//ol>"); re=/(/[/*/])/ig; strcontent=strcontent.replace(re,"<li>");
re=/(/[center/])(.*?)(/[//center/])/ig strcontent=strcontent.replace(re,"<center>$2</center>")
re=/(/[table=(#*[a-z0-9]*),(#*[a-z0-9]*),(#*[a-z0-9]*)/])(.*?)(/[//table/])/ig strcontent=strcontent.replace(re,"<table border=0 cellpadding=5 cellspacing=1 bgcolor=$2><tr><td bgcolor=$3><font color=$4>$5</font></td></tr></table>")
return(strcontent);}</script>
vbscript:
<style>.codesamp { padding-right: 0.5em; margin-top: 1em; padding-left: 0.5em; font-size: 8p; margin-bottom: 1em; padding-bottom: 0.5em; margin-left: 0pt; padding-top: 0.5em; font-family: "courier new"; background-color: #eeeeee;width: 480px;overflow:hidden;border: 1px solid #888888;|||}textarea {border-width: 1; border-color: #000000;font-size: 12px;font-family: "tahoma", "ms shell dlg";}</style>
[code][html]test[/html][/code]</textarea><br><button onclick=show.innerhtml=ubbcode(phx.value)>转换</button><br><div id=show style="border:1 solid skyblue;width=500;font-size: 12px;font-family: 'tahoma', 'ms shell dlg';"></div>
<script language=vbs>stricons = "1" '答应笑脸转换strsmile="1" '同上imgname="em"picurl="pic/"
function ubbcode(content)'on error resume nextst=timerset re=new regexpre.global=true
re.pattern="/[code/](/r/n)?([/s/s] ?)/[//code/]"set matches = re.execute(content) ' execute search.dim code()n=0if re.test(content) then codeb=trueif codeb then for each match in matches ' iterate matches collection. redim preserve code(n) code(n) =match.value n=n 1 nextfor i=0 to ubound(code)if code(i)="" then exit forcontent=replace(content,code(i),"{code"&i&"}")nextend if
re.pattern="/[html/](/r/n)?([/s/s] ?)/[//html/]"set matches = re.execute(content) ' execute search.dim html()n=0if re.test(content) then htmlb=trueif htmlb then for each match in matches ' iterate matches collection. redim preserve html(n) html(n) =match.valuen=n 1 nextfor i=0 to ubound(html)if html(i)="" then exit forcontent=replace(content,html(i),"{html"&i&"}")nextend if
content=gmt(content) 'ubb
if codeb thenfor i=0 to ubound(code)if code(i)="" then exit fortcode=hencode(code(i)) content=replace(content,"{code"&i&"}",tcode)nextend if'-----re.pattern="/[html/](/r/n)?([/s/s] ?)/[//html/]"set matches = re.execute(content) ' execute search.dim html2()n=0if re.test(content) then html2b=trueif html2b then for each match in matches ' iterate matches collection. redim preserve html2(n) html2(n) =match.valuen=n 1 nextfor i=0 to ubound(html2)if html2(i)="" then exit forcontent=replace(content,html2(i),"{html2"&i&"}")nextend if
if htmlb thenfor i=0 to ubound(html)if html(i)="" then exit forthtml=hencode(html(i))content=replace(content,"{html"&i&"}",thtml)nextend if
re.pattern="(/[code/])(/r/n)?([/s/s] ?)(/[//code/])"content=re.replace(content,"<pre class=codesamp>$3</pre>")
re.pattern="(/[html/])(/r/n)?([/s/s] ?)(/[//html/])"content=re.replace(content,"<span><textarea cols=95 rows=12>$3</textarea><br><input onclick=runcode() type=button value=运行代码>[ctrl a 全部选择 提示:你可先修改部分代码,再按运行]</span>")|||
if html2b thenfor i=0 to ubound(html2)if html2(i)="" then exit forthtml2=html2(i)content=replace(content,"{html2"&i&"}",thtml2)nextend if
ubbcode=contentmsgbox "转换共耗时 "&formatnumber((timer-st)*1000,2)&" ms"end function
function hencode(fstring) '简单模拟server.htmlencode asp中不用这个 fstring = replace(fstring,"&","&") fstring = replace(fstring,">",">") fstring = replace(fstring,"<","<") hencode=fstringend function
function dvbbshtmlan(fstring)
if not isnull(fstring) then fstring=hencode(fstring) fstring = replace(fstring, chr(9), " ") 'tab fstring = replace(fstring, chr(34), """) '" fstring = replace(fstring, chr(39), "'") '' fstring = replace(fstring, chr(13), "") '回车是一个13 10 fstring = replace(fstring, chr(10) & chr(10), "<p>")' ' fstring = replace(fstring, chr(10), "<br>") fstring = replace(fstring, chr(32), " ") ' 空格 dvbbshtmlan = fstringend ifend function
function gmt(strcontent)
strcontent=dvbbshtmlan(strcontent) dim re set re=new regexp re.ignorecase =true re.global=true
re.pattern="(/[img/])(.*?)(/[//img/])" strcontent=re.replace(strcontent,"<a href=$2 target=_blank><img src=""$2"" border=0 alt=按此在新窗口浏览图片 this.width=screen.width-333"" galleryimg=no></a>")
if not usersign or (usersign and userimgcode=1) then re.pattern="/[dir=*([0-9]*),*([0-9]*)/](.*?)/[//dir]" strcontent=re.replace(strcontent,"<object classid=clsid:166b1bca-3f9c-11cf-8075-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0 width=$1 height=$2><param name=src value=$3><embed src=$3 pluginspage=http://www.macromedia.com/shockwave/download/ width=$1 height=$2></embed></object>") re.pattern="/[qt=*([0-9]*),*([0-9]*)/](.*?)/[//qt]" strcontent=re.replace(strcontent,"<embed src=$3 width=$1 height=$2 autoplay=true loop=false controller=true playeveryframe=false cache=false scale=tofit bgcolor=#000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/quicktime/>") re.pattern="/[mp=*([0-9]*),*([0-9]*)/](.*?)/[//mp]" strcontent=re.replace(strcontent,"<object align=middle classid=clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=object id=mediaplayer width=$1 height=$2 ><param name=showstatusbar value=-1><param name=filename value=$3><embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701 flename=mp src=$3 width=$1 height=$2></embed></object>") re.pattern="/[rm=*([0-9]*),*([0-9]*)/](.*?)/[//rm]" strcontent=re.replace(strcontent,"<object classid=clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa class=object id=raocx width=$1 height=$2><param name=src value=$3><param name=console value=clip1><param name=controls value=imagewindow><param name=autostart value=true></object><br><object classid=clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa height=32 id=video2 width=$1><param name=src value=$3><param name=autostart value=-1><param name=controls value=controlpanel><param name=console value=clip1></object>")||| end if
re.pattern="(/[flash/])(.*?)(/[//flash/])" strcontent= re.replace(strcontent,"<object codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=500 height=400><param name=movie value=""$2""><param name=quality value=high><embed src=""$2"" quality=high pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width=500 height=400>$2</embed></object>") re.pattern="(/[flash=*([0-9]*),*([0-9]*)/])(.*?)(/[//flash/])" strcontent= re.replace(strcontent,"<a href=""$4"" target=_blank><img src=pic/swf.gif border=0 alt=点击开新窗口欣赏该flash动画!> [全屏欣赏]</a><br><br><object codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=$2 height=$3><param name=movie value=""$4""><param name=quality value=high><param name=menu value=false><embed src=""$4"" quality=high menu=false pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width=$2 height=$3>$4</embed></object>")
re.pattern="(/[upload=gif/])(.*?)(/[//upload/])" strcontent= re.replace(strcontent,"<br><img src="""&picurl&"gif.gif"" border=0>此主题相关图片如下:<br><a href=""$2"" target=_blank><img src=""$2"" border=0 alt=按此在新窗口浏览图片 this.width=screen.width-333""></a>") re.pattern="(/[upload=jpg/])(.*?)(/[//upload/])" strcontent= re.replace(strcontent,"<br><img src="""&picurl&"jpg.gif"" border=0>此主题相关图片如下:<br><a href=""$2"" target=_blank><img src=""$2"" border=0 alt=按此在新窗口浏览图片 this.width=screen.width-333""></a>") re.pattern="(/[upload=bmp/])(.*?)(/[//upload/])" strcontent= re.replace(strcontent,"<br><img src="""&picurl&"bmp.gif"" border=0>此主题相关图片如下:<br><a href=""$2"" target=_blank><img src=""$2"" border=0 alt=按此在新窗口浏览图片 this.width=screen.width-333""></a>")
re.pattern="(/[upload=(.[^/*)/])(.*?)(/[//upload/])" strcontent= re.replace(strcontent,"<br><img src="""&picurl&"$2.gif"" border=0> <a href=""$3"">点击浏览该文件</a>")
re.pattern="(/[url/])(.*?)(/[//url/])" strcontent= re.replace(strcontent,"<a href=""$2"" target=_blank>$2</a>") re.pattern="(/[url=(.[^/*)/])(.*?)(/[//url/])" strcontent= re.replace(strcontent,"<a href=""$2"" target=_blank>$3</a>")
re.pattern="(/[email/])(.*?)(/[//email/])" strcontent= re.replace(strcontent,"<img align=absmiddle src=pic/email1.gif><a href=""$2|||mailto:$2"">$2</a>") re.pattern="(/[email=(.[^/*)/])(.*?)(/[//email/])" strcontent= re.replace(strcontent,"<img align=absmiddle src=pic/email1.gif><a href=""mailto:$2"" target=_blank>$3</a>")
re.pattern = "^(http://[a-za-z0-9/./=/?%/-&_~`@': !] )" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re.pattern = "(http://[a-za-z0-9/./=/?%/-&_~`@': !] )$" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re.pattern = "(<br>|<p>)(|
http://[a-za-z0-9/./=/?%/-&_~`@': !] )(<br>|<p>)" strcontent = re.replace(strcontent,"$1<img align=absmiddle src=pic/url.gif><a target=_blank href=$2>$2</a>$3") re.pattern = "^(ftp://[a-za-z0-9/./=/?%/-&_~`@': !] )" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re.pattern = "(ftp://[a-za-z0-9/./=/?%/-&_~`@': !] )$" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re.pattern = "[^>=""](ftp://[a-za-z0-9/.//=/?%/-&_~`@': !] )" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re.pattern = "^(rtsp://[a-za-z0-9/./=/?%/-&_~`@': !] )" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re.pattern = "(rtsp://[a-za-z0-9/./=/?%/-&_~`@': !] )$" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re.pattern = "[^>=""](rtsp://[a-za-z0-9/.//=/?%/-&_~`@': !] )" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re.pattern = "^(mms://[a-za-z0-9/./=/?%/-&_~`@': !] )" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re.pattern = "(mms://[a-za-z0-9/./=/?%/-&_~`@': !] )$" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>") re.pattern = "[^>=""](mms://[a-za-z0-9/.//=/?%/-&_~`@': !] )" strcontent = re.replace(strcontent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
if stricons = "1" then '笑脸转换 re.pattern="(/["&imgname&"(.*?)/])"||| strcontent=re.replace(strcontent,"<img src="&picurl&imgname&"$2.gif border=0 align=middle>") end if
if strsmile = "1" then '笑脸转换 re.pattern="(/[s(/d{1,2})/])" strcontent=re.replace(strcontent,"<img src=smile/face$2.gif border=0 align=middle>") end if
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>")'循环转换quote re.pattern="(/[quote/])(.*?)(/[//quote/])" while (instr(strcontent,"[quote]")>0 and instr(strcontent,"[/quote]")>0) strcontent=re.replace(strcontent,"<blockquote>引用:<hr><span>$2</span><hr></blockquote>") wend re.pattern="(/[fly/])(.*?)(/[//fly/])" strcontent=re.replace(strcontent,"<marquee width=90% behavior=alternate scrollamount=3>$2</marquee>") re.pattern="(/[move/])(.*?)(/[//move/])" strcontent=re.replace(strcontent,"<marquee scrollamount=3>$2</marquee>") re.pattern="/[glow=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)/](.*?)/[//glow]" strcontent=re.replace(strcontent,"<table width=$1 style=""filter:glow(color=$2, strength=$3)"">$4</table>") re.pattern="/[shadow=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)/](.*?)/[//shadow]" strcontent=re.replace(strcontent,"<table width=$1 style=""filter:shadow(color=$2, strength=$3)"">$4</table>")
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=5 style=""line-height:"&fontheight&"pt"">$2</font>") re.pattern="(/[size=4/])(.*?)(/[//size/])" strcontent=re.replace(strcontent,"<font size=6 style=""line-height:"&fontheight&"pt"">$2</font>") re.pattern="/[size=([ |-]?[0-7])/](.*?)(/[//size/])" strcontent=re.replace(strcontent,"<font size=$1 style=""line-height:"&fontheight&"pt"">$2</font>")
re.pattern="(/[center/])(.*?)(/[//center/])"||| strcontent=re.replace(strcontent,"<center>$2</center>")
re.pattern="(/[table=(#*[a-z0-9]*),(#*[a-z0-9]*),(#*[a-z0-9]*)/])(.*?)(/[//table/])" strcontent=re.replace(strcontent,"<table border=0 cellpadding=5 cellspacing=1 bgcolor=$2><tr><td bgcolor=$3><font color=$4>$5</font></td></tr></table>")
'[html/] start 're.pattern="(/[html/])(.*?)(/[//html/])" 'strcontent=re.replace(strcontent,"<span><textarea cols=95 rows=12>$2</textarea><br><input onclick=runcode() type=button value=运行代码>[ctrl a 全部选择 提示:你可先修改部分代码,再按运行]</span>")
'[html/] end
set re=nothing gmt=strcontentend function
</script>
练就火眼金睛 十一种常见电脑
打印机共享提示“操作无法完成
如何查找有故障的配件
回眸一笑百魅生,六宫粉黛无颜色
岁月静美,剪一影烟雨江南
芜湖有个“松鼠小镇”
小满:小得盈满,一切刚刚好!
一串串晶莹剔透的葡萄,像一颗颗宝石挂在藤
正宗老北京脆皮烤鸭
人逢知己千杯少,喝酒搞笑图集
搞笑试卷,学生恶搞答题
新闻热点
疑难解答
图片精选
Dreamweaver问题集锦大全
Dreamweaver CS3 的最新功能
Dreamweaver CS3代码片断功能面板
Dreamweaver技巧:运用代码片断工具
网友关注