UBB 转换函数演示(5)_Dreamweaver教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

//循环转换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;

来源:网上收集//所属分类:Dreamweaver教程/更新时间:2005-05-04
相关Dreamweaver教程