提取路径
<P align=left> <IMG style= "WIDTH: 156px; HEIGHT: 119px " height=599 src= "/DataBase/mypiczw/2007521152946486.jpg " width=800 border=0> asdfsdfasdfasdfasdfasdf </P>
这段在数据库存的代码
我想把图的路径取出来有这个函数吗
[解决办法]
正则,或者给img一个id后放到某个div中再getElementById()去取src~
[解决办法]
<textarea id=textarea1>
<P align=left> <IMG style= "WIDTH: 156px; HEIGHT: 119px " height=599 src= "/DataBase/mypiczw/2007521152946486.jpg " width=800 border=0> asdfsdfasdfasdfasdfasdf </P>
</textarea>
<script language=vbs>
alert(aaa(textarea1.value))
function aaa(x)
dim re,mmm,m,i
set re = new RegExp
re.Pattern = "src= " "[^ " "]* " " "
re.Global = true
re.IgnoreCase = true
set mmm = re.execute(x)
for each m in mmm
i = i + 1
aaa = aaa & m & vbcrlf
aaa=replace(aaa, "src= ", " ")
aaa=replace(aaa, " " " ", " ")
next
set re =nothing
end function
</script>
简单匹配提取,