当前位置: 代码迷 >> ASP >> 幻灯广告~求解~小弟我不会JS读数据库
  详细解决方案

幻灯广告~求解~小弟我不会JS读数据库

热度:56   发布时间:2012-05-10 16:02:39.0
幻灯广告~~求解~~我不会JS读数据库


这是一个很多网站常用的JS滚动广告. 请问如果要动态的从数据库里面读取图片地址.URL链接和名称应该怎么写?  
以下附代码 

JScript code
JScript code


   <!--
    var focus_width=190
    var focus_height=160
    var text_height=20
    var swf_height = focus_height+text_height

    var pics='js/images/1.jpg|js/images/2.jpg|js/images/3.jpg|js/images/4.jpg|js/images/5.jpg|js/images/6.jpg'
    var links='http://www.elandkey.com|http://www.elandkey.com|http://www.elandkey.com|http://www.elandkey.com|http://www.elandkey.com|http://www.elandkey.com'
    var texts='1|2|3|4|5|6'

    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="js/flash/cgal.swf"><param name="quality" value="high"><param name="bgcolor" value="#CCCCCC">');
    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="#ffffff" 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>');

    //-->
// JavaScript Document



这个是整个广告的源代码 
请大家帮忙改下然后贴出来~

我不会用JS读数据库 ,有其他办法吗???

------解决方案--------------------
<script type="text/javascript"> 
var pics="" 
var links="" 
var texts="" 
<% 
sql = "select top 5 * from aa" 
rs.open sql,conn,1,1 
if not(rs.bof and rs.eof) then 
dim i 
dim picsStr,linksStr,textsStr 
i = 1 
do while not rs.eof 
%> 
pics=pics+"pic/ <%=rs("图片路径")%> " 
links=links+escape(" <%=rs("连接路径")%> ") 
texts=texts+" <%=rs("标题")%> " 
<% 
rs.movenext 
i = i + 1 
loop 
end if 
rs.close 

%> 

var focus_width=240 
var focus_height=200 
var text_height=18 
var swf_height = focus_height+text_height 
  
//var pics=imgUrl1+" ¦"+imgUrl2+" ¦"+imgUrl3+" ¦"+imgUrl4+" ¦"+imgUrl5 
// var links=imgLink1+" ¦"+imgLink2+" ¦"+imgLink3+" ¦"+imgLink4+" ¦"+imgLink5 
// var texts=imgtext1+" ¦"+imgtext2+" ¦"+imgtext3+" ¦"+imgtext4+" ¦"+imgtext5 
  
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 +'"> '); 
  相关解决方案