導航:首頁 > 凈水問答 > 過濾回車符asp

過濾回車符asp

發布時間:2021-03-24 13:48:01

『壹』 ASP特殊字元過濾

Function ChkInvaildWord(Words)
Const InvaildWords=\"select|update|delete|insert|@|--|,\" \'\'需要過濾得字元以「|」隔開,最後結束的字元必須是|

ChkInvaildWord=True
InvaildWord=Split(InvaildWords,\"|\")
inWords=LCase(Trim(Words))

For i=LBound(InvaildWord) To UBound(InvaildWord)
If Instr(inWords,InvaildWord(i))>0 Then
ChkInvaildWord=True
Exit Function
End If
Next
ChkInvaildWord=False
End Function

你所得到的只是一個加ChkInvaildWord事件的代碼
看你怎麼去用了

例如 你現在接受了一個STR的值
那麼就直接 ChkInvaildWord(STR)
如果STR中間有特殊字元 那麼你就得到了FALSE
如果沒有 那麼你就得到TRUE
一般都都會在前面加上IF判斷。。

然後輸出 錯誤
完整的就如1樓的

『貳』 關於ASP過濾空格換行

replace(內容," ", "")

『叄』 asp中如何過濾掉特殊字元

user=replace(trim(request.form("uName")),"'","''")
password=replace(trim(request.form("Password")),"'","''")
if instr(user,"%") or instr(user,"#") or instr(user,"?") or instr(user,"|") or instr(user,"'") then
response.write "<script language=javascript>alert('您的姓名含有非法字元!');this.location.href='login.asp';</script>"
response.end
end if

if instr(password,"%") or instr(password,"#") or instr(password,"?") or instr(password,"|") then
response.write "<script language=javascript>alert('您的密碼含有非法字元!');this.location.href='login.asp';</script>"
response.end
end if 我自己做的,希望對你有幫助

『肆』 asp怎麼樣去掉調用數據中的回車換行

16:54修改
-----------------------
<%Function FormatHTML(fString)
If fString<>"" Then
fString = trim(fString)
fString = replace(fString, ";", ";") '分號過濾
fString = replace(fString, "--", "--") '--過濾
fString = replace(fString, "%20", "") '特殊字元過濾
fString = replace(fString, "==", "") '==過濾
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """")
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), " ") '---------這行 改了
fString = Replace(fString, CHR(10), "") '---------這行 也改了
FormatHTML = fString
End If
End Function %>

然後調用的時候
<%=FormatHTML(rs("inc_text"))%>

『伍』 ASP字元過濾。

username=trim(request.form("username"))
'定義一個數組
badCode="<,%,@,upload"
'分割數據
badCode=split(badCode,",")
'從第一個循環到最後一個
for i = 0 to ubound(badCode)
username=replace(username,badCode(i),"") '把這專些字元替換屬為空
next

『陸』 請問怎麼過濾掉ASP留言本里的空格/回車

原因:
沒有進行HTML轉換,比如<br>  等字元就被直接讀取而非解析。
解決方法:
在留言讀取頁面上加上這個函數。
<%
function HTMLEncode(fString)
if not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = replace(fString, """", """)
fString = Replace(fString, CHR(32), "")
fString = Replace(fString, CHR(9), "")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
fString = Replace(fString, CHR(10), "<BR>")
fString=ChkBadWords(fString)
HTMLEncode = fString
end if
end function
%>
然後原來的比如說a=rs.b
就要改成a=HTMLEncode(rs.b),這個時候原來<br>就被解析成回車了。

『柒』 ASP里的回車與換行

1、ASP里的回車與換行是chr(13)&chr(10),或者&vbcrlf。

2、chr(13)&chr(10)、&vbcrlf換行指的是源文件中代碼的換行,並不是瀏覽器顯示的換行效果。

3、瀏覽器中顯示的換行是需要在html代碼中用<br>。

例子:

<%

Response.write "1、我在源文件中" & chr(13)&chr(10) & "才能換行,瀏覽器顯示在一行"

Response.write "2、<br>我在瀏覽器中<br>換行了,在源代碼中是一行"

%>

瀏覽器顯示效果:

『捌』 asp去除所有樣式包括空格html標簽回車符等,只顯示content裡面內容的前100個字,要真正能用的

<%
Function RemoveHTML( strText )
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern = "<[^>]*>"
RegEx.Global = True
RemoveHTML = RegEx.Replace(strText, "")
End Function
response.Write left(RemoveHTML(rs("content")),100)&"..." %>

『玖』 asp如何替換記事本中的換行符為回車符 急!在線等

如果讀取文本沒問題,那麼讀取到記事本裡面的所有內容後,使用replace,如:

content=replace(content,vbcrlf,"<br />")

vbCrlf則回車換行符號。

『拾』 asp中輸出欄位去除回車字元

replace(string,chr(13),"")

閱讀全文

與過濾回車符asp相關的資料

熱點內容
什麼牌子乳化液污水處理 瀏覽:904
射陽污水管網公司怎麼樣 瀏覽:841
水質含水垢會影響腎結石嗎 瀏覽:961
夏新凈水器怎麼擺放 瀏覽:946
飲水機不出水是什麼原因抽水 瀏覽:359
瓷磚除垢劑不銹鋼變黑補救 瀏覽:180
過濾棉出售 瀏覽:808
臨沂生產雨污水管廠家 瀏覽:336
野馬漢騰空調濾芯在哪裡 瀏覽:504
神仙水用蒸餾水稀釋 瀏覽:753
離子交換器設計規范 瀏覽:523
晉州如何處理工業廢水 瀏覽:39
凈水機能賣什麼廢品 瀏覽:822
光澤環氧樹脂地坪 瀏覽:506
小區裝修垃圾水處理 瀏覽:512
養殖廢水濃度一般是多少 瀏覽:962
躍進濾芯怎麼樣 瀏覽:258
億能電池能加蒸餾水 瀏覽:838
六月份北京回牡丹江用隔離嗎 瀏覽:796
空氣凈化器沒有加濕功能怎麼辦 瀏覽:583