1. Practique el uso del objeto de solicitud para aceptar datos y usar de manera integral algunas funciones.
cnbruce.html
| <form de acción = "cnbruce.asp" método = "post"> <input type = "text" name = "title"> <br> <Textarea name = "Content" filas = 10 cols = 20> </textarea> <br> <input type = "enviar"> </form> |
cnbruce.asp
| <% función th (str) str = reemplazar (str, "joder", "md") str = reemplazar (str, "dum", "kao") th = str función final Función codifica (STR) str = reemplazar (str, ">", ">") str = reemplazar (str, "<", "<") str = reemplazar (str, chr (32), "") str = reemplazar (str, chr (13), "") str = reemplazar (str, chr (10) y chr (10), "</p> <p>") str = reemplazar (str, chr (10), "<br>") codificar = str función final %> <%title = request.form ("title") content = request.form ("content")%> Título del artículo: <%= th (título)%> <hr> Contenido del artículo: <%= encode (th (contenido))%> |
TH (STR) es una función personalizada, y la función principal es muy simple: los caracteres de filtro. Encode (STR) también es una función personalizada, y su función principal es mostrar completamente la información aprobada.
CHR (10) representa la ruptura de línea, Chr (13) representa el retorno del carro y CHR (32) representa el espacio.
Función adicional: Mostrar código UBB.
Es decir, UBB.ASP contiene la función ubb ().
Mejorado cnbruce.asp
| <!-#include file = "http://www.cnbruce.com/blog/ubb.asp"-> <% función th (str) str = reemplazar (str, "joder", "md") str = reemplazar (str, "dum", "kao") th = str función final %> <script> function runEx (COD1) { Cod = document.all (COD1) var Code = Cod.Value; if (código! = "") { var newwin = Window.open ('', '', ''); newwin.opener = nulo newwin.document.write (código); newwin.document.close (); } } </script> <%title = request.form ("title") content = request.form ("content")%> Título del artículo: <%= th (título)%> <hr> Contenido del artículo: <%= UBB (UNHTML (TH (contenido)))%> |