<%
Response.Write (server.htmlencocode (FixImg ("<imgonclick =" "if (this.width> screen.width-461) Wind ow.open ('qq / 20082181405371.jpg'); "" alt = "" "" border = "" 0 "" src = "" qq / 20082181405371.jpg "" /> "))))
%>
<%
'功能: 将 img 代码格式化为 <imgsrc = "xxx" /> 格式.
Functionfiximg (sString)
DimsReallydo, Regex, Ireallydo
Dimomatches, cmatch
DimtStarttime, Tendime
Ifisnull (sstring) puis
FixImg = ""
Sortie
Endire
sreallodo = sstring
Onerrorresumenext
sreallodo = remplacer (sreallodo, vbcr, "")
sreallodo = remplacer (sreallodo, vblf, "")
sreallodo = remplacer (sreallodo, vbtab, "")
sreallodo = remplacer (sreallodo, "<img", vbcrlf & "<img", 1, -1,1)
sreallodo = remplacer (sreallodo, "/>", "/>", 1, -1,1)
sreallodo = remplaceall (sreallodo, "=", "=", true)
sreallodo = remplaceall (sreallodo, ">", ">", true)
sreallodo = remplacer (sreallodo, "> <", ">" & vbcrlf & "<")
Sreallodo = TRIM (SREALLYDO)
Onerrorgoto0
SetRegex = newRegexp
regex.ignorecase = true
regex.global = true
'// 去除 onclick, onload 等脚本
regex.pattern = "/ s [on]. +? = ([/" "| /'m de par exemple.
sreallodo = regex.replace (sreallodo, "")
'// 将 src 不带引号的图片地址加上引号
regex.pattern = "<img. *? / ssrc = ([^ /" "/ '/ s] [^ /" "/' / s>] *). *?>"
sreallodo = regex.replace (sreallodo, "<imgsrc =" "1 $" "/>")
'// 正则匹配图片 src 地址
regex.pattern = "<img. *? / ssrc = ([/" "/ ']) ([^ /" "/'] +?) / 1. *?>"
sreallodo = regex.replace (sreallodo, "<imgsrc =" "2 $" "/>")
FixImg = Sreallodo
Finition de fin