The following is a reference fragment: <% Response.Write (Server.HTMLEncode (fiximg ("screen.width-461) window.open (' qq/ 20082181405371.jpg '); "" Alt= "" "" Border= "" 0 "" src= "" qq/20082181405371.jpg ""/> ")) %> <% ' Function: Format the IMG code as format. ' Reference: http://www.alixixi.com
Function fiximg (sstring)
Dim Sreallydo, RegEx, Ireallydo Dim Omatches, Cmatch Dim Tstarttime, Tendtime If IsNull (sstring) Then Fiximg = "" Exit Function End If Sreallydo = sstring On Error Resume Next Sreallydo = Replace (Sreallydo, vbcr, "") Sreallydo = Replace (Sreallydo, vblf, "") Sreallydo = Replace (Sreallydo, VbTab, "") Sreallydo = Replace (Sreallydo, "Sreallydo = Replace (Sreallydo, "/>", "/>", 1,-1, 1) Sreallydo = ReplaceAll (Sreallydo, "=", "=", True) Sreallydo = ReplaceAll (Sreallydo, ">", ">", True) Sreallydo = Replace (Sreallydo, "><", ">" & vbCrLf & "<") Sreallydo = Trim (Sreallydo) On Error GoTo 0 Set regEx = New RegExp Regex.ignorecase = True Regex.global = True '//Remove scripts such as Onclick,onload Regex.pattern = "\s[on].+?= ([\" "|\ '])" (. *?) \1 " Sreallydo = Regex.Replace (Sreallydo, "") '//Add quotation marks to the picture address of SRC without quotes Regex.pattern = "]*) .*?>" Sreallydo = Regex.Replace (Sreallydo, "'//Regular matching picture src address Regex.pattern = " " Sreallydo = Regex.Replace (Sreallydo, "Fiximg = Sreallydo End Function %> <% ' Function: Returns a string in which a specified number of substrings are replaced by another substring. ' Source: http://www.alixixi.com Function ReplaceAll (Sexpression, Sfind, Sreplacewith, BAll) If IsNull (sexpression) Then ReplaceAll = "": Exit Function If (StrComp (BAll, "True", 1) = 0) Or (CBool (Bint (bAll)) = True) Then Do While INSTR (1, Sexpression, Sfind, 1) > 0 Sexpression = Replace (Sexpression, Sfind, Sreplacewith, 1,-1, 1) If InStr (1, Sreplacewith, Sfind, 1) >0 Then Exit do Loop Else Do While INSTR (Sexpression, Sfind) > 0 Sexpression = Replace (Sexpression, Sfind, Sreplacewith) If InStr (Sreplacewith, Sfind) > 0 Then Exit do Loop End If ReplaceAll = Sexpression End Function %> <% ' Function: Only numbers ' Source: http://www.alixixi.com
Function Bint (STR) str = Trim (str) If str = "" or IsNull (str) or not isnumeric (str) Then str = "0" Bint = Round (Str, 0) End Function %> |