一些簡(jiǎn)單的ASP練習(xí)
更新時(shí)間:2007年01月03日 00:00:00 作者:
1,練習(xí)使用request對(duì)象接受數(shù)據(jù),并且綜合運(yùn)用些函數(shù)。
cnbruce.html
cnbruce.asp
th(str)為自定義函數(shù),主要功能很簡(jiǎn)單:過(guò)濾字符。encode(str)也為自定義函數(shù),主要功能是完整地顯示被傳遞的信息。
CHR(10)表示換行,CHR(13)表示回車,CHR(32)表示空格。
附加功能:顯示UBB代碼。
即ubb.asp中含有ubb()函數(shù)。
增強(qiáng)的cnbruce.asp
cnbruce.html
<form action="cnbruce.asp" method="post"> <input type="text" name="title"><br> <textarea name="content" rows=10 cols=20></textarea><br> <input type="submit"> </form> |
cnbruce.asp
<% function th(str) str=replace(str,"媽的","MD") str=replace(str,"靠","KAO") th=str end function function encode(str) str = replace(str, ">", ">") str = replace(str, "<", "<") str = Replace(str, CHR(32), " ") str = Replace(str, CHR(13), "") str = Replace(str, CHR(10) & CHR(10), "</P><P>") str = Replace(str, CHR(10), "<BR>") encode=str end function %> <%title=request.form("title") content=request.form("content")%> 文章標(biāo)題:<%=th(title)%><hr> 文章內(nèi)容:<%=encode(th(content))%> |
th(str)為自定義函數(shù),主要功能很簡(jiǎn)單:過(guò)濾字符。encode(str)也為自定義函數(shù),主要功能是完整地顯示被傳遞的信息。
CHR(10)表示換行,CHR(13)表示回車,CHR(32)表示空格。
附加功能:顯示UBB代碼。
即ubb.asp中含有ubb()函數(shù)。
增強(qiáng)的cnbruce.asp
<!--#include file="http://www.cnbruce.com/blog/ubb.asp"--> <% function th(str) str=replace(str,"媽的","MD") str=replace(str,"靠","KAO") th=str end function %> <script> function runEx(cod1) { cod=document.all(cod1) var code=cod.value; if (code!=""){ var newwin=window.open('','',''); newwin.opener = null newwin.document.write(code); newwin.document.close(); } } </script> <%title=request.form("title") content=request.form("content")%> 文章標(biāo)題:<%=th(title)%><hr> 文章內(nèi)容:<%=ubb(unhtml(th(content)))%> |
相關(guān)文章
純編碼實(shí)現(xiàn)Access數(shù)據(jù)庫(kù)的建立或壓縮
純編碼實(shí)現(xiàn)Access數(shù)據(jù)庫(kù)的建立或壓縮...2006-06-06ASP中常用的22個(gè)FSO文件操作函數(shù)整理
ASP中FSO組件的功能很強(qiáng)大,如果沒(méi)有FSO很難想象ASP會(huì)變成什么樣。對(duì)于學(xué)習(xí)asp編程的朋友一定會(huì)接觸到FSO相關(guān)的操作,如備份數(shù)據(jù)庫(kù),讀取文件,生成靜態(tài)頁(yè)面等等。本文就列舉了ASP中常用的22個(gè)FSO文件操作函數(shù),相信能為您帶來(lái)方便2020-02-02