动态调用FLASH幻灯片

本文介绍了一种使用ASP动态获取数据库中的图片信息,并通过Flash进行展示的方法。该方法利用了Chr函数来拼接字符串,实现了从数据库中读取图片路径、标题和链接等信息的功能,并将这些信息传递给Flash组件进行显示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

chr(13) 是一个回车

Chr(
10) 是个换行符

chr(
32) 是一个空格符

chr(
34) 是一个"
-------------------------------------------------------------

<!--#include file=include/conn.asp -->
var indexPicURL=
"uploadfile/";

<%
dim cou,i
set rs11=server.CreateObject(
"adodb.recordset")
rs11.Source =
"select * from News where picnews=1 and checkked=1 and picname<>null order by NewsID DESC"
rs11.Open rs11.Source,conn,3,1
cou=rs11.recordcount
'response.Write(cou)
'response.Write(
"<br>")
i=1
dim indexPicURL
do while not rs11.eof

response.Write(
"imgUrl"&i&"=indexPicURL+"&chr(34)&rs11("picname")&chr(34)&";")
Response.Write   Chr(10)
response.Write(
"imgtext"&i&"="&chr(34)&rs11("title")&chr(34)&";")
Response.Write   Chr(10)
response.Write(
"imgLink"&i&"=escape("&chr(34)&"ReadNews.asp?NewsID="&rs11("newsid")&chr(34)&");")
Response.Write   Chr(10)

'for(i=1;i<cou)
'for (x=0;x<prmo.length;x++) {
' promos += (x+1<prmo.length) ? prmo[x]+
"|" : prmo[x];
' links += (x+1<prmo.length) ? link[x]+
"|" : link[x];
'}
'response.Write(i)

if(i<cou) then
  pics=pics+
"imgUrl"&i&"+"&chr(34)&"|"&chr(34)&"+"
  links=links+
"imgLink"&i&"+"&chr(34)&"|"&chr(34)&"+"
  texts=texts+
"imgtext"&i&"+"&chr(34)&"|"&chr(34)&"+"
else 
  pics=pics+
"imgUrl"&i
  links=links+
"imgLink"&i
  texts=texts+
"imgtext"&i
end if
'response.Write(
"<br>")
'pics=pics+
"imgUrl"&i&"+"&chr(34)&"|"&chr(34)&"+"
'links=links+
"imgLink"&i&"+"&chr(34)&"|"&chr(34)&"+"
'texts=texts+
"imgtext"&i&"+"&chr(34)&"|"&chr(34)&"+"
i=i+1
rs11.movenext
loop
rs11.close
set rs11=nothing
%>
var focus_width=480;
var focus_height=215;
var text_height=0;
var swf_height = focus_height+text_height;
<%
response.Write(
"var pics="&pics&";")
Response.Write   Chr(10)
response.Write(
"var links="&links&";")
Response.Write   Chr(10)
response.Write(
"var texts="&texts&";")
Response.Write   Chr(10)
%>
document.write(
"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='swflash.cab' width="+focus_width +" height="+ swf_height +">");
document.write(
"<param name=allowScriptAccess value=sameDomain><param name=movie value='pixviewer4.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  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 ='480'height='215' allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer />");
 document.write('</object>');

 &是可以连接不同的数据类型

+号只能用于连接字符串.

必须用连接符 & 就可以把字符串和变量连接起来

 

 


var indexPicURL="uploadfile/";

imgUrl1
=indexPicURL+"2007102885438972.jpg";
imgtext1
="我还是来了啊";
imgLink1
=escape("ReadNews.asp?NewsID=462");
imgUrl2
=indexPicURL+"2007102884548425.jpg";
imgtext2
="不走了";
imgLink2
=escape("ReadNews.asp?NewsID=461");
imgUrl3
=indexPicURL+"2007102884222563.jpg";
imgtext3
="又来了啊";
imgLink3
=escape("ReadNews.asp?NewsID=460");
imgUrl4
=indexPicURL+"2007102883543756.jpg";
imgtext4
="我来尝试";
imgLink4
=escape("ReadNews.asp?NewsID=459");

var focus_width=480;
var focus_height=215;
var text_height=0;
var swf_height = focus_height+text_height;
var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4;
var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4;
var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4;

document.write(
"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='swflash.cab' width="+focus_width +" height="+ swf_height +">");
document.write(
"<param name=allowScriptAccess value=sameDomain><param name=movie value='pixviewer4.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  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 ='480'height='215' allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer />");
 document.write(
'</object>');

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值