代码在下面:
<script language='javascript'>
linkarr = new Array();
picarr = new Array();
textarr = new Array();
var swf_width=198;
var swf_height=136;
//文字颜色|文字位置|文字背景颜色|文字背景透明度|按键文字颜色|按键默认颜色|按键当前颜色|自动播放时间|图片过渡效果|是否显示按钮|打开方式
var configtg='0xffffff|0|0x3FA61F|5|0xffffff|0xC5DDBC|0x000033|2|3|1|_blank';
var files = "";
var links = "";
var texts = "";
//这里设置调用标记
linkarr[1] ="#1";
picarr[1] = "Images/companyinfo_03.jpg";
textarr[1]="";
linkarr[2] ="#2";
picarr[2] = "Images/hengjia_02.jpg";
textarr[1]="";
linkarr[3] ="#3";
picarr[3] = "Images/companyinfo_03.jpg";
textarr[1]="";
linkarr[4] ="#4";
picarr[4] = "Images/product_03.jpg";
textarr[1]="";
linkarr[5] ="#5";
picarr[5] = "Images/companyinfo_03.jpg";
textarr[1]="";
for(i=1;i<picarr.length;i++){
if(files=="") files = picarr[i];
else files += "|"+picarr[i];
}
for(i=1;i<linkarr.length;i++){
if(links=="") links = linkarr[i];
else links += "|"+linkarr[i];
}
for(i=1;i<textarr.length;i++){
if(texts=="") texts = textarr[i];
else texts += "|"+textarr[i];
}
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="'+ swf_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="Images/bcastr3.swf"><param name="quality" value="high">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'&bcastr_config='+configtg+'">');
document.write('<embed src="Images/bcastr3.swf" wmode="opaque" FlashVars="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'&bcastr_config='+configtg+'&menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>');
</script>
现在的问题就是我想让上面的picarr里面的图片路径动态的从数据库的新闻表中取出来。我不知道怎么弄啊,请教高手们。我的数据库是Access的
6 个解决方案
#1
其实你也要有更简单的方法,前台放一个hidden ,后台加载时赋值,在JS中,取其value就Ok了!Are you OK?
#2
在后台得到数据库中的链接后存储到数组中保存在页面的hidden域中,或者在js中使用<%=%>直接使用后台声明为public的数组,前台循环赋值给 picarr数组
#3
<%=str%>
获取变量值
ajax获取数据
获取变量值
ajax获取数据
#4
<script language="javascript">
//用 javascript 写服务器端连接数据库的代码示例
function conn(){
var db_bbs
db_bbs="dd.mdb"//定义数据库
var conn = new ActiveXObject("ADODB.Connection");
conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+db_bbs+"");
var rs = new ActiveXObject("ADODB.Recordset");
var sql="select name from authors"; //数据库中有authors表,name字段
rs.open(sql,conn);
alert(rs(0))//取出第一个来
conn.close();
conn = null;
}
</script>
#5
<script type="text/javascript">
var myImages='<%=flashUrl%>';
var myLink="";
var myText="";
var myWidth="";
var myHight="";
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='926' height='321'>");
document.write("<param name=allowScriptAccess value=sameDomain><param name=movie value=images/pix.swf><param name=quality value=high><param name=bgcolor value=#DCDCDC>");
document.write("<param name=menu value=false><param name=wmode value=opaque>");
document.write("<param name=FlashVars value='pics="+myImages+"&links=#|#|#|#|#&texts=广告标题&borderwidth=926&borderheight=320&textheight=1'>");
document.write("<embed src=images/pix.swf wmode=opaque FlashVars='pics="+myImages+"&links=#|#|#|#|#&texts=广告标题&borderwidth=926&borderheight=320&textheight=1' menu=false bgcolor=#DCDCDC quality=high width='926' height='320' allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer>");
document.write("</object>");
</script>
然后在后台中得到flashUrl
var myImages='<%=flashUrl%>';
var myLink="";
var myText="";
var myWidth="";
var myHight="";
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='926' height='321'>");
document.write("<param name=allowScriptAccess value=sameDomain><param name=movie value=images/pix.swf><param name=quality value=high><param name=bgcolor value=#DCDCDC>");
document.write("<param name=menu value=false><param name=wmode value=opaque>");
document.write("<param name=FlashVars value='pics="+myImages+"&links=#|#|#|#|#&texts=广告标题&borderwidth=926&borderheight=320&textheight=1'>");
document.write("<embed src=images/pix.swf wmode=opaque FlashVars='pics="+myImages+"&links=#|#|#|#|#&texts=广告标题&borderwidth=926&borderheight=320&textheight=1' menu=false bgcolor=#DCDCDC quality=high width='926' height='320' allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer>");
document.write("</object>");
</script>
然后在后台中得到flashUrl
#6
学习了,知道怎么做了
#1
其实你也要有更简单的方法,前台放一个hidden ,后台加载时赋值,在JS中,取其value就Ok了!Are you OK?
#2
在后台得到数据库中的链接后存储到数组中保存在页面的hidden域中,或者在js中使用<%=%>直接使用后台声明为public的数组,前台循环赋值给 picarr数组
#3
<%=str%>
获取变量值
ajax获取数据
获取变量值
ajax获取数据
#4
<script language="javascript">
//用 javascript 写服务器端连接数据库的代码示例
function conn(){
var db_bbs
db_bbs="dd.mdb"//定义数据库
var conn = new ActiveXObject("ADODB.Connection");
conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+db_bbs+"");
var rs = new ActiveXObject("ADODB.Recordset");
var sql="select name from authors"; //数据库中有authors表,name字段
rs.open(sql,conn);
alert(rs(0))//取出第一个来
conn.close();
conn = null;
}
</script>
#5
<script type="text/javascript">
var myImages='<%=flashUrl%>';
var myLink="";
var myText="";
var myWidth="";
var myHight="";
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='926' height='321'>");
document.write("<param name=allowScriptAccess value=sameDomain><param name=movie value=images/pix.swf><param name=quality value=high><param name=bgcolor value=#DCDCDC>");
document.write("<param name=menu value=false><param name=wmode value=opaque>");
document.write("<param name=FlashVars value='pics="+myImages+"&links=#|#|#|#|#&texts=广告标题&borderwidth=926&borderheight=320&textheight=1'>");
document.write("<embed src=images/pix.swf wmode=opaque FlashVars='pics="+myImages+"&links=#|#|#|#|#&texts=广告标题&borderwidth=926&borderheight=320&textheight=1' menu=false bgcolor=#DCDCDC quality=high width='926' height='320' allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer>");
document.write("</object>");
</script>
然后在后台中得到flashUrl
var myImages='<%=flashUrl%>';
var myLink="";
var myText="";
var myWidth="";
var myHight="";
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='926' height='321'>");
document.write("<param name=allowScriptAccess value=sameDomain><param name=movie value=images/pix.swf><param name=quality value=high><param name=bgcolor value=#DCDCDC>");
document.write("<param name=menu value=false><param name=wmode value=opaque>");
document.write("<param name=FlashVars value='pics="+myImages+"&links=#|#|#|#|#&texts=广告标题&borderwidth=926&borderheight=320&textheight=1'>");
document.write("<embed src=images/pix.swf wmode=opaque FlashVars='pics="+myImages+"&links=#|#|#|#|#&texts=广告标题&borderwidth=926&borderheight=320&textheight=1' menu=false bgcolor=#DCDCDC quality=high width='926' height='320' allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer>");
document.write("</object>");
</script>
然后在后台中得到flashUrl
#6
学习了,知道怎么做了