aspÈçºÎÈ¥³ýhtml±ê¼Ç
·½·¨Ò» : ½ûÓÃHTML
×î¼òµ¥µÄ·½·¨ÊÇÖ±½Ó½ûÓÃhtml±êÇ©¶ø²»ÓÃÒƳýËüÃÇ. ¿ÉÒÔʹÓÃReplace()º¯Êý. ÀýÈç:
strText = Replace(strText, "<script", "<script", 1, -1, 1)
»òÕßÖ±½Ó½ûÓÃËùÓеÄhtml:
strText = Replace(strText, "<", "<")
ÕâÑù×öËäÈ»ºÜ°²È«,µ«ÏԵò»¹»ÓѺÃ.(Óû§Ìá½»µÄÎı¾»á±äµÃÄÑÒÔÔĶÁ)
·½·¨¶þ: ʹÓÃ"<"ºÍ">"
ÔõÑùʹµÃhtml±êÇ©´ÓÎı¾ÖÐÏûʧÄØ? ÎÒÃÇ¿ÉÒÔÈ¥µô"<"ºÍ">"ÖмäµÄËùÓÐÄÚÈÝ
ÔÚJavaScriptÖÐÕâºÜ¼òµ¥:
function RemoveHTML( strText )
{
var regEx = /<[^>]*>/g;
return strText.replace(regEx, "");
}
ÏÖÔڻص½VBScript, ¶ÔÓÚScriptingÒýÇæ5.0»ò¸ü¸ß°æ±¾(¿ÉÒÔͨ¹ýµ÷ÓÃScriptEngineMajorVersionºÍScriptEngineMinorVersionº¯ÊýÀ´¼ìÑé°æ±¾),ÎÒÃÇÒ²¿ÉÒÔʹÓÃRegExpÎïÌå:
Function RemoveHTML( strText )
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern = "<[^>]*>"
RegEx.Global = True
RemoveHTML = RegEx.Replace(strText, "")
End Function
Èô²»ÓÃÕýÔò±í´ïʽ,ÏÂÃæµÄº¯Êý¿ÉÒԴﵽͬÑùµÄÄ¿µÄ:
Function RemoveHTML( strText )
Dim nPos1
Dim nPos2
nPos1 = InStr(strText, "<")
Do While nPos1 > 0
nPos2 = InStr(nPos1 + 1, strText, ">")
If nPos2 > 0 Then
strText = Left(strText, nPos1 - 1) & Mid(strText, nPos2 + 1)
Else
Exit Do
End If
nPos1 = InStr(strText, "<")
Loop
&nbs
Ïà¹ØÎĵµ£º
Ç°ÑÔ£º
²»ÉÙÈ˶¼ÍƳçѧϰ±à³Ì×î¼Ñ·½Ê½ÊÇÔÚʵ¼ÊÏîÄ¿ÖÐÄ¥Á·£¬Í¨¹ý½â¾öÏîÄ¿ÖеÄÒ»¸ö¸öʵ¼ÊÎÊÌ⽫Ïà¹ØµÄ֪ʶµãѧÒÔÖÂÓá£×÷Ϊ¸Õ¸ÕÂõÉϱà³Ì/web¿ª·¢×Ôѧ֮·µÄÐÂÊÖ£¬ÎÒ±ã´òË㽫¸Ãѧϰ·½Ê½¼ÓÒÔʵ¼ù£¬²¢Í¨¹ý²©¿Íƽ̨¼Ç¼×Ô¼ºµÄѧϰµãµÎ¡£
ÎҵĵÚÒ»¸öʵ¼ùÏîÄ¿±ãÊÇÁôÑ԰壬֮ËùÒÔÑ¡ÔñASP+AccessÊÇÒòΪ¼òµ¥Ò×Óã¬Èç¹ûÒ»ÇÐ˳Àû´ýÉÏ ......
Ò»°ãÀ´Ëµ±àÊý¾Ý¿âÀàµÄ³ÌÐòÖ÷ÒªÒª½â¾öµÄÎÊÌâÎÞ·ÇÊÇÌí¼Ó£¬É¾³ý£¬Ð޸ĺͲéѯ¡£ÕâÀà±à³Ì¶¼·Ç³£µÄ¼òµ¥¡£½ÓÏÂÀ´ÎÒÀûÓÃÒ»µã¿ÕÓàʱ¼ä·¢Ò»¸öº¯ÊýÀïÃæ°üº¬ºÍÌí¼ÓºÍɾ³ý¹¦ÄÜ¡£ÊµÑéµÄ¼Ü¹¹¿ÉÒÔʹÓÃIIS.5WEB·þÎñÆ÷ACCESSÊý¾Ý¿â¡£Õâ¸öÎÒÆäʵ²»ÓÃ˵µÄºÜÏêϸÁË£¬ÒòΪ´ó¼Ò¶¼Ó¦¸ÃÖªµÀµÄ¡£ÎÒ¾ÍÖ±½Ó°Ñº¯ÊýÌù³öÀ´¡£´ó¼ÒÖ»ÒªÉÔÎ ......
<%
Response.Buffer = true
Response.Clear
dim url
Dim fso,fl,flsize
dim Dname
Dim objStream,ContentType,flName,isre,url1
Dim strFileName
strFileName=replace(replace(Request("file"),"\",""),"/","") '´«²Î
strFileName="/files/"&strFileName ' ¸Ä³ÉÄãÄãÎļþµÄ´æ ......
Îļþ1.ÉÏ´«½çÃæÎļþ upload.htm
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>ÎļþÉÏ´«</title>
</head>
......