1。要求オブジェクトを使用してデータを受け入れ、いくつかの機能を包括的に使用します。
cnbruce.html
| <form action = "cnbruce.asp" method = "post"> <input type = "text" name = "title"> <br> <textarea name = "content" rows = 10 cols = 20> </textarea> <br> <入力型= "submit"> </form> |
cnbruce.asp
| <% 関数th(str) str =置換(str、 "fuck"、 "md") str =置換(str、 "dum"、 "kao") th = str エンド関数 関数エンコード(str) str =置換(str、 ">"、 ">") str =置換(str、 "<"、 "<") str =置換(str、chr(32)、 "") str =置換(str、chr(13)、 "") str =置換(str、chr(10)&chr(10)、 "</p> <p>") str =置換(str、chr(10)、 "<br>") Encode = str エンド関数 %> <%title = request.form( "title") content = request.form( "content")%> 記事タイトル:<%= th(title)%> <hr> 記事コンテンツ:<%= encode(th(content))%> |
Th(str)はカスタム関数であり、メイン関数は非常に単純です:フィルター文字。エンコード(str)もカスタム関数であり、その主な関数は、渡された情報を完全に表示することです。
CHR(10)はラインブレイクを表し、CHR(13)はキャリッジリターンを表し、CHR(32)はスペースを表します。
追加機能:UBBコードを表示します。
つまり、ubb.aspにはubb()関数が含まれています。
強化されたcnbruce.asp
| <! - #include file = "http://www.cnbruce.com/blog/ubb.asp" - > <% 関数th(str) str =置換(str、 "fuck"、 "md") str =置換(str、 "dum"、 "kao") th = str エンド関数 %> <スクリプト> functionrunex(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")%> 記事タイトル:<%= th(title)%> <hr> 記事の内容:<%= ubb(unhtml(th(content)))%> |