首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

提取路径,该怎么处理

2012-02-04 
提取路径PalignleftIMGstyle WIDTH:156pxHEIGHT:119px height599src /DataBase/mypiczw/200752

提取路径
<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>

简单匹配提取,

热点排行