发信人: yuchix() 
整理人: fishy(2000-11-08 09:09:30), 站内信件
 | 
 
 
写一个函数过程,从Html中提取图片文件名及目录。并将他们存入一个字串数组 ,请高手指点,要程序代码。
  
 转载自csdn.net
 
  
 
 dim img() as string
 sub parsehtml()
 dim idx as long,l as long
 dim tmp as string,tmp1 as string
 open "yourpage.htm" for input as #1
 do until eof(1)
     line input #1,tmp
     tmp=lcase(tmp)
     l=instr(tmp,"<img")
     if l<>0 then
         tmp1=mid(tmp,l+1)
         l=instr(tmp1,">")
         if l<>0 then
             tmp1=left(tmp1,l-1)
             if instr(tmp1,"src=")<>0 then
                 idx=idx+1
             end if
         end if
     end if
 loop
 close #1
 redim img(idx)
 idx=0
 open "yourpage.htm" for input as #1
 do until eof(1)
     line input #1,tmp
     tmp=lcase(tmp)
     l=instr(tmp,"<img")
     if l<>0 then
         tmp1=mid(tmp,l+1)
         l=instr(tmp1,">")
         if l<>0 then
             tmp1=left(tmp1,l-1)
             if instr(tmp1,"src=")<>0 then
                 if mid(tmp1,instr(tmp1,"src=")+1,1)=chr(34) then
                     tmp1=mid(tmp1,instr(tmp1,"src=")+2)
                     img(idx)=left(tmp1,instr(tmp1,chr(34))-1)
                     idx=idx+1
                 else
                     tmp1=mid(tmp1,instr(tmp1,"src=")+1)
                     img(idx)=left(tmp1,instr(tmp1," ")-1)
                     idx=idx+1
                 end if
             end if
         end if
     end if
 loop
 close #1
 end sub
  -- 網易彩色簽名檔生成器
 令你的簽名更出色
 http://go.163.com/~yuchix/BBSNNint.zip
  ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.103.137.71]
  | 
 
 
 |