導航:首頁 > 凈水問答 > 過濾回車符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相關的資料

熱點內容
樹脂材料的楊氏模量 瀏覽:646
超濾膜芯那個牌子好 瀏覽:375
半夜沖奶用什麼飲水機好 瀏覽:394
生物水處理公司招聘 瀏覽:702
防塵過濾棉批發 瀏覽:729
寧波超純水多少錢 瀏覽:687
凈水器反滲透膜怎麼安 瀏覽:880
新標致408空調濾芯在哪裡 瀏覽:509
化工大型超濾機 瀏覽:211
寶馬換汽油濾芯多少時間 瀏覽:493
飲水機在什麼店鋪買 瀏覽:686
公司買的純凈水放哪個科目 瀏覽:829
提升機制動器的市場現狀 瀏覽:691
空氣濾芯封邊用什麼膠 瀏覽:397
酚醛樹脂醚化作用 瀏覽:928
離子交換樹脂膨脹率 瀏覽:120
污水處理專業書籍讀後感 瀏覽:43
東莞市傑邦水處理科技有限公司 瀏覽:538
油煙凈化器變徑買太大了怎麼辦 瀏覽:531
為什麼家用凈水機的水仍有水垢 瀏覽:572