WEB开发网
开发学院WEB开发ASP 常用ASP自定义函数集 (S.Sams) 阅读

常用ASP自定义函数集 (S.Sams)

 2008-10-27 12:06:30 来源:WEB开发网   
核心提示: rem ---Html过滤函数 Being-Function Htmlout(str)CODE Copy ...dim resultdim lif isNULL(str) thenHtmlout=""exit functionend ifl=len(str)result

rem ---Html过滤函数 Being-----------------------------Function Htmlout(str)

CODE Copy ...

dim result
dim l
if isNULL(str) then
Htmlout=""
exit function
end if
l=len(str)
result=""
dim i
for i = 1 to l
select case mid(str,i,1)
case "<"
result=result+"<"
case ">"
result=result+">"
case chr(13)
if session("admin_system")="" then
result=result+"<br>"
end if
case chr(34)
result=result+"""
case "&"
result=result+"&"
case chr(32)
'result=result+" "
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then
result=result+" "
else
result=result+" "
end if
else
result=result+" "
end if
case chr(9)
result=result+" "
case else
result=result+mid(str,i,1)
end select
next
Htmlout=result
End Function

rem ---textarea显示用---

CODE Copy ...

function htmlencode1(fString)
if fString<>"" and not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, " ", chr(32))
fString = Replace(fString, "</p><p>", CHR(10) & CHR(10))
fString = Replace(fString, "<br>", CHR(10))
htmlencode1=fString
else
htmlencode1=""
end if
end function

上一页  1 2 3 4 5 6 7  下一页

Tags:常用 ASP 定义

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接