很简单啊
看你使用什么语言
比如ASP和JS的结合:<%
w=271
h=170
n=34set rs = server.CreateObject ("adodb.recordset")
sql="select top "&num&" * from news where photo<>'' and flag=1 order by isshow desc, istop desc, id desc"
rs.open sql,conn,1,1
if rs.recordcount=0 then
  Response.Write "<BR><center>没有图片新闻!</center>"
elsefor i=1 to rs.recordcount

pic1=rs("photo")
title1=rs("title")
id=rs("id")
rs.movenext
if rs.eof then exit for
pic2=rs("photo")
title2=rs("title")
id2=rs("id")
rs.movenext
if rs.eof then exit for
pic3=rs("photo")
title3=rs("title")
id3=rs("id")
rs.movenext
if rs.eof then exit for
pic4=rs("photo")
title4=rs("title")
id4=rs("id")
rs.movenext
if rs.eof then exit for
pic5=rs("photo")
title5=rs("title")
id5=rs("id")
rs.movenext
if rs.eof then exit for 
pic6=rs("photo")
title6=rs("title")
id6=rs("id")
rs.movenext
if rs.eof then exit for
pic7=rs("photo")
title7=rs("title")
id7=rs("id")
rs.movenext
if rs.eof then exit for 
pic8=rs("photo")
title8=rs("title")
id8=rs("id")
rs.movenext
if rs.eof then exit for
next
rs.close
set rs=nothing
%>
 <style type="text/css">
<!--
.STYLE1 {color: #FF0000}
.STYLE3 {
color: #3366FF;
font-size: -1;
}
.STYLE5 {
font-size: -1;
color: #FF9933;
font-weight: bold;
}
-->
 </style>
 <a target=_blank href="javascript:goUrl()"> 
                    <span class="f14b">
                    <script type="text/javascript">
imgUrl1="<%=pic1%>";
imgtext1="<%=title1%>";
imgLink1=escape("news/show.asp?newsid=<%=id%>&action=news");
imgUrl2="<%=pic2%>";
imgtext2="<%=title2%>";
imgLink2=escape("news/show.asp?newsid=<%=id2%>&action=news");
imgUrl3="<%=pic3%>";
imgtext3="<%=title3%>";
imgLink3=escape("news/show.asp?newsid=<%=id3%>&action=news");
imgUrl4="<%=pic4%>";
imgtext4="<%=title4%>";
imgLink4=escape("news/show.asp?newsid=<%=id4%>&action=news");
imgUrl5="<%=pic5%>";
imgtext5="<%=title5%>";
imgLink5=escape("news/show.asp?newsid=<%=id5%>&action=news");
imgUrl6="<%=pic6%>";
imgtext6="<%=title6%>";
imgLink6=escape("news/show.asp?newsid=<%=id6%>&action=news");
imgUrl7="<%=pic7%>";
imgtext7="<%=title7%>";
imgLink7=escape("news/show.asp?newsid=<%=id7%>&action=news");
imgUrl8="<%=pic8%>";
imgtext8="<%=title8%>";
imgLink8=escape("news/show.asp?newsid=<%=id8%>&action=news"); var focus_width=<%=w%>
 var focus_height=<%=h%>
 var text_height=0
 var swf_height = focus_height+text_height
 
 var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4+"|"+imgUrl5+"|"+imgUrl6
 var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4+"|"+imgLink5+"|"+imgLink6
 var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4+"|"+imgtext5+"|"+imgtext6
 
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="playswf.swf"><param name=wmode value=transparent><param name="quality" value="high">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="playswf.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#DADADA" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  document.write('</object>');
//-->
</script> 
</span></a><span id=focustext class=f14b> </span><%
end if%>