'html'에 해당되는 글 1건

  1. 2009.04.24 Html 처리

Html 처리

Windows/ASP 2009. 4. 24. 13:34
-------------------------------------소스-----------------------------------
<%
Function no_html(contents)
contents = trim(contents) '앞, 뒤 공백제거
contents = replace(replace(contents,"<","&lt;"),">","&gt;") '<, > 처리
contents = replace(contents,chr(13)&chr(10),"<br>") 'Enter 처리
contents = replace(contents,chr(32),"&nbsp;") 'Space Bar 처리
contents = replace(contents,chr(9),"&nbsp;&nbsp;&nbsp;&nbsp;") 'Tab 처리
contents = replace(contents,"'","''") '작은따옴표(') 처리

contents = replace(contents,"&lt;%","<font color=""800000"">&lt;%") 'Asp 불능..처리
contents = replace(contents,"%&gt;","%&gt;</font>")

no_html = contents
End Function

Function html(contents)
contents = trim(contents) '앞, 뒤 공백제거
contents = replace(contents,"<t","&lt;t") '<table 테그 사용금지1
contents = replace(contents,"<T","&lt;T") '<table 테그 사용금지2
'contents = replace(contents,"<tr"&"<Tr","&lt;tr") '<tr 테그 사용금지
'contents = replace(contents,"<td"&"<Td","&lt;td") '<td 테그 사용금지
contents = replace(contents,"'","''") '작은따옴표(') 처리

contents = replace(contents,"<"&chr(37),"<font color=""800000"">&lt;%") 'Asp 불능..처리
contents = replace(contents,chr(37)&">","%&gt;</font>") 'Asp 불능..처리

html = contents
End Function
%>

<%
aa = no_html(request("aa"))
cc = html(request("aa"))
%>
Posted by 아로스
1

아로스

달력

05-18 20:44