📄 tohtml.asp
字号:
<%
Function to_html(s_string)
to_html = Replace(s_string, """", """)
to_html = Replace(to_html, "<", "<")
to_html = Replace(to_html, ">", ">")
to_html = Replace(to_html, vbcrlf, "<br>")
to_html = Replace(to_html, "/<", "<")
to_html = Replace(to_html, "/>", ">")
to_html = edit_hrefs(to_html)
to_html = replace(to_html, "[img]","<div align='center'><img src=""",1,-1,1)
to_html = replace(to_html, "[/img]",""" border=0></div>", 1, -1, 1)
to_html=replace(to_html,"[url=","",1,-1,1)
to_html=replace(to_html,"[/url]","",1,-1,1)
to_html=replace(to_html,"[email=","",1,-1,1)
to_html=replace(to_html,"[/email]","",1,-1,1)
to_html = replace(to_html, "[b]","<b>", 1, -1, 1)
to_html = replace(to_html, "[/b]","</b>", 1, -1, 1)
to_html = replace(to_html, "[u]","<u>", 1, -1, 1)
to_html = replace(to_html, "[/u]","</u>", 1, -1, 1)
to_html = replace(to_html, "[i]","<i>", 1, -1, 1)
to_html = replace(to_html, "[/i]","</i>", 1, -1, 1)
End Function
%>
<script language="javascript1.2" runat=server>
function edit_hrefs(s_html){
// 一个使用正则表达式的典范
// 转换文本中所有的超链接和电子邮件格式
s_str = new String(s_html);
s_str = s_str.replace(/\bhttp\:\/\/www(\.[\w+\.\:\/\_]+)/gi,
"http\:\/\/¬¤¸$1");
s_str = s_str.replace(/\b(http\:\/\/\w+\.[\w+\.\:\/\_]+)/gi,
"<a href=\"$1\">$1<\/a>");
s_str = s_str.replace(/\b(www\.[\w+\.\:\/\_]+)/gi,
"<a href=\"http://$1\">$1</a>");
s_str = s_str.replace(/\bhttp\:\/\/¬¤¸(\.[\w+\.\:\/\_]+)/gi,
"<a href=\"http\:\/\/www$1\">http\:\/\/www$1</a>");
s_str = s_str.replace(/\b(\w+@[\w+\.?]*)/gi,
"<a href=\"mailto\:$1\">$1</a>");
return s_str;
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -