ASP幻灯片新闻代码:
<!--这是一个主页文件-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>幻灯片新闻</title>
</head>
<body>
<!--#Include file="diaoyong.asp"-->
</body>
</html>
<!--
只要调用下面这个文件就可以了
这是一个文件名为:diaoyong.asp的文件
flash文件在符件里面
-->
<%
'幻灯片新闻
Db="../webjx_Data/webjx_Data.Asp"
Set conn = Server.CreateObject("ADODB.Connection")
Connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
Conn.Open Connstr
sql="select top 5 * from [Music_List_Tupian_System] where IswNumsSex='轮换广告' order by IswNumsID desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.eof then
k=1
Num_total=rs.recordcount
for i=1 to 5
if i>Num_total then exit for
if i=1 then
imgUrl11="Img/"&rs("IswNumsPhoto")
if len(rs("IswNumsUser"))>=18 then
imgtext11= left(rs("IswNumsUser"),18)&"..."
else
imgtext11=rs("IswNumsUser")
end if
imgLink11=rs("IswNumsClass")
end if
if i=2 then
imgUrl22="Img/"&rs("IswNumsPhoto")
if len(rs("IswNumsUser"))>=18 then
imgtext22= left(rs("IswNumsUser"),18)&"..."
else
imgtext22=rs("IswNumsUser")
end if
imgLink22=rs("IswNumsClass")
end if
if i=3 then
imgUrl33="Img/"&rs("IswNumsPhoto")
if len(rs("IswNumsUser"))>=18 then
imgtext33= left(rs("IswNumsUser"),18)&"..."
else
imgtext33=rs("IswNumsUser")
end if
imgLink33=rs("IswNumsClass")
end if
if i=4 then
imgUrl44="Img/"&rs("IswNumsPhoto")
if len(rs("IswNumsUser"))>=18 then
imgtext44= left(rs("IswNumsUser"),18)&"..."
else
imgtext44=rs("IswNumsUser")
end if
imgLink44=rs("IswNumsClass")
end if
if i=5 then
imgUrl55="Img/"&rs("IswNumsPhoto")
if len(rs("IswNumsUser"))>=18 then
imgtext55= left(rs("IswNumsUser"),18)&"..."
else
imgtext55=rs("IswNumsUser")
end if
imgLink55=rs("IswNumsClass")
end if
rs.movenext
k=k+1
next
else
response.write "暂时没有数据!"
end if
%>
<a target=_self href="javascript:goUrl()"> <span class="f14b">
<script type="text/javascript">
imgUrl1="<%=imgUrl11%>";
imgtext1="<%=imgtext11%>"
imgLink1=escape("<%=imgLink11%>");
imgUrl2="<%=imgUrl22%>";
imgtext2="<%=imgtext22%>"
imgLink2=escape("<%=imgLink22%>");
imgUrl3="<%=imgUrl33%>";
imgtext3="<%=imgtext33%>"
imgLink3=escape("<%=imgLink33%>");
imgUrl4="<%=imgUrl44%>";
imgtext4="<%=imgtext44%>"
imgLink4=escape("<%=imgLink44%>");
imgUrl5="<%=imgUrl55%>";
imgtext5="<%=imgtext55%>"
imgLink5=escape("<%=imgLink55%>");
var focus_width=200
var focus_height=160
var text_height=18
var swf_height = focus_height+text_height
<%if Num_total=1 then%>
var pics=imgUrl1
var links=imgLink1
var texts=imgtext1
<%elseif Num_total=2 then%>
var pics=imgUrl1+"|"+imgUrl2
var links=imgLink1+"|"+imgLink2
var texts=imgtext1+"|"+imgtext2
<%elseif Num_total=3 then%>
var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3
var links=imgLink1+"|"+imgLink2+"|"+imgLink3
var texts=imgtext1+"|"+imgtext2+"|"+imgtext3
<%elseif Num_total=4 then%>
var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4
var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4
var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4
<%elseif Num_total=5 then%>
var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4+"|"+imgUrl5
var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4+"|"+imgLink5
var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4+"|"+imgtext5
<%end if%>
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_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>