使用正则表达式实现模式图片新闻.ASP

80酷酷网    80kuku.com

  正则|正则'文字或特定图片模式显示新闻

function shownew(content,ntype)

shownew = ""

if(ntype = 1) then

shownew = shownew &" <TABLE width=100% >"
shownew = shownew &"<TR>"
shownew = shownew &" <TD width=600 valign=top>"&ShowPic(content)&"</TD>"
shownew = shownew &"</TR>"
shownew = shownew &"<TR>"
shownew = shownew &" <TD valign=top = shownew &"</TR>"
shownew = shownew &"</TABLE>"


elseif (ntype = 2) then


shownew = shownew &" <TABLE width='100%'>"

shownew = shownew &"<TR>"
shownew = shownew &" <TD valign=top>"&OnlyWord(content)&"</TD>"
shownew = shownew &"</TR>"
shownew = shownew &"<TR>"
shownew = shownew &" <TD width=600 valign=top = shownew &"</TR>"
shownew = shownew &"</TABLE>"

elseif (ntype = 3) then


shownew = shownew &"<TABLE>"

shownew = shownew &"<TR>"
shownew = shownew &"<TD width=100 valign=top>"&ShowPic(content)&"</TD>"

shownew = shownew &"<TD width=80% valign=top>"&OnlyWord(content)&"</TD>"


shownew = shownew &"</TR>"
shownew = shownew &"</TABLE>"

elseif (ntype = 4) then

shownew = shownew &"<TABLE>"

shownew = shownew &"<TR>"

shownew = shownew &"<TD width=80% valign=top shownew = shownew &"<TD width=100 valign=top>"&ShowPic(content)&"</TD>"

shownew = shownew &"</TR>"
shownew = shownew &"</TABLE>"
else
shownew = shownew & "<table><tr><td if

end function

'显示提取的图片
function ShowPic(strng)

ShowPic = ""
ImageUrl= RegExpExecute(strng)

ImageUrls = Split(ImageUrl,"
")

for i = LBound(ImageUrls) to (UBound(ImageUrls) - 1)

ShowPic = ShowPic & ("<a href='"&ImageUrls(i)&"' target=_blank><image src='"&ImageUrls(i)&"' border='0' alt='按此在新窗口浏览图片' 设置模式。
OnlyWord=re.Replace(strng,"")

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: