当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP实例:幻灯片新闻代码

ASP
ASP下经常用的字符串等函数参考资料
asp下连接数据库 ASP链接数据库字符串大全总结
asp内置对象 ObjectContext 事务管理 详解
asp 内置对象 Application 详解
ASP中 SQL语句 使用方法
ASP 中 Split 函数的实例分析
ASP 中 DateDiff 函数详解 主要实现两日期加减操作
asp 存贮过程 (SQL版asp调用存储过程)
利用ASP实现在线生成电话图片效果脚本附演示
使用ASP记录在线用户的数量的代码
关于ASP生成伪参数技巧 简洁实用的伪(僞)参数
asp 关键词字符串分割如何实现方法
用ASP编写的加密和解密类
ASP之处理用Javascript动态添加的表单元素数据的代码
asp下最常用的19个基本技巧
一些Asp技巧和实用解决方法
asp实现一个统计当前在线用户的解决方案
asp下的一个很简单的验证码程序
asp又一个分页的代码例子
asp实现防止从外部提交数据的三种方法

ASP实例:幻灯片新闻代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 208 ::
收藏到网摘: n/a

以下为引用的内容:

<!--这是一个主页文件-->
<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>