我从网上下的JS相册代码 它的图片是固定的直接把地址写在里面
例如连续的几行:
<img src=固定的路径>;
<img src=.......>;
<img src=.......>;而我想连接数据库 点击播放后可以自动播放数据库中某一类型的全部图片
怎么写连接代码读图片路径啊
给个思路也行 或者指点一下
例如连续的几行:
<img src=固定的路径>;
<img src=.......>;
<img src=.......>;而我想连接数据库 点击播放后可以自动播放数据库中某一类型的全部图片
怎么写连接代码读图片路径啊
给个思路也行 或者指点一下
然后点播放就循环读取数组
用setTimeout定时换图片即可
<script type="text/javascript">
var image = ['','','',''];//图片路径
int count = 0;
window.onload = function(){
document.all.imagsId.src = image[count];
document.all.imagsId.display = "block";
count++;
if (count >= image.lenght) {
count = 0;
}
}</script>
<img src="" id="imagsId">
请教LONGLY:如何把需要的图片地址都读取出来存入数组?写一句关键的格式吧请教xk1126:能发一份详细的代码让我研究一下否 小弟先谢谢了 [email protected]
<img src = "img2/P1.jpg" id = "tree1" name="tree1" width=749px height=226px>
<img src = "img2/P2.jpg" id = "tree2" name="tree2" width=749px height=226px>
<img src = "img2/P3.jpg" id = "tree3" name="tree3" width=749px height=226px>
<img src = "img2/P4.jpg" id = "tree4" name="tree4" width=749px height=226px>
<img src = "img2/P5.jpg" id = "tree5" name="tree5" width=749px height=226px>
<img src = "img2/P6.jpg" id = "tree6" name="tree6" width=749px height=226px>
<img src = "img2/P7.jpg" id = "tree7" name="tree7" width=749px height=226px>
<img src = "img2/P8.jpg" id = "tree8" name="tree8" width=749px height=226px>
</div>
<tr>
<td align="left"><table width="947" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td style="border: 1px solid #f7bc96;margin-bottom:0px;padding-bottom:0px" height="226px">
<!--
<img src="img/banner.gif" border="0"/>
-->
<img src="img2/P3.jpg" id ="the_pic" width="749px" height="226px" border="0"/>
</td>
<td style="border: 1px solid #f7bc96;"><SCRIPT language=javascript>frist("swf/jft-512.swf", "196px", "226px");</SCRIPT></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10"> </td>
</tr>
<script language="javascript">
var pic=new Array();
// var num=0;
var xxa=0;
setinter();
function setinter(){
setInterval('show_pic()',3000); //Run();
}
function show_pic(){ //var pic_src=new Array();
var PnoPic = document.getElementById("images1").getElementsByTagName("img");
//var num1 = document.getElementById("num1").value;
if(document.all){
tran=Math.floor(Math.random()*23)+1;
//alert(tran);
document.getElementById("the_pic").style.filter="revealtrans(dulation=2,transition="+tran+")";
document.getElementById("the_pic").filters.revealtrans.Apply();
}
document.getElementById("the_pic").src=PnoPic[xxa].src;
xxa = xxa+1;
if(xxa>PnoPic.length-1){
xxa = 0;
}
if(document.all){
document.getElementById("the_pic").filters.revealtrans.Play();}
}</script>
然后更换IMG的src属性就可以了。