急!!!求助javascript实现图片循环切换(一定要循环哦)
<styletype="text/css">.A1:hover{font-size:12px;color:#ffffff;background-image:url(ima...
<style type="text/css">
.A1:hover{font-size:12px;color:#ffffff;background-image:url(images/bg1.gif);width:100px;height:30px;border:0px #FF99CC solid;}
td{font-size:13PX;line-height:30px;}
</style>
<script type="text/javascript">
function show(d1){
var i;
for(i=1;i<5;i++){
if(i==d1){
document.getElementById(d1).style.display='block';
}else{
document.getElementById(i).style.display='none';}
}
}
<td><table width="580" height="310" border="0" cellspacing="0" cellpadding="0" align="center" ><tr>
<td width="193"><div id="1" style="display:block;">
<table style="border-right: #cccccc 1px solid; border-top: #cccccc 1px solid; border-left: #cccccc 1px solid; border-bottom: #cccccc 1px solid; background-image:url(images/b1.jpg); width:580px; height:300px" border="0" cellpadding="0" cellspacing="0">
<tr><td><a href="GiftView.aspx?id=1"><img src="images/19.jpg" width="230" height="290" style="border:0" alt=""/></a></td>
</tr>
</table></div>
<div id="2" style="display:none;">
<table style="border-right: #cccccc 1px solid; border-top: #cccccc 1px solid; border-left: #cccccc 1px solid; border-bottom: #cccccc 1px solid; background-image:url(images/b1.jpg); width:580px; height:300px" border="0" cellpadding="0" cellspacing="0"><tr>
<td><a href="FlowerView.aspx?id=37"><img src="images/37.jpg" width="230" height="290" style="border:0" alt=""/></a></td></tr>
</table>
</div>
<div id="4" style="display:none;">
<td width="95" align="center" style="height: 11px"><font color="#FFFFFF"><a href="#" class=" A1" onmouseover="javascript:show('1')">精美礼品</a></font></td>
<td width="95" align="center" style="height: 11px"><a href="#" class=" A1" onmouseover="javascript:show('2')">最新上市</a></td>
<td width="95" align="center" style="height: 11px"><a href="#" class=" A1" onmouseover="javascript:show('3')">热卖鲜花</a></td>
<td width="95" align="center" style="height: 11px"><a href="#" class=" A1" onmouseover="javascript:show('4')">免费玩具</a></td>
</tr>
</table>
</td> 展开
.A1:hover{font-size:12px;color:#ffffff;background-image:url(images/bg1.gif);width:100px;height:30px;border:0px #FF99CC solid;}
td{font-size:13PX;line-height:30px;}
</style>
<script type="text/javascript">
function show(d1){
var i;
for(i=1;i<5;i++){
if(i==d1){
document.getElementById(d1).style.display='block';
}else{
document.getElementById(i).style.display='none';}
}
}
<td><table width="580" height="310" border="0" cellspacing="0" cellpadding="0" align="center" ><tr>
<td width="193"><div id="1" style="display:block;">
<table style="border-right: #cccccc 1px solid; border-top: #cccccc 1px solid; border-left: #cccccc 1px solid; border-bottom: #cccccc 1px solid; background-image:url(images/b1.jpg); width:580px; height:300px" border="0" cellpadding="0" cellspacing="0">
<tr><td><a href="GiftView.aspx?id=1"><img src="images/19.jpg" width="230" height="290" style="border:0" alt=""/></a></td>
</tr>
</table></div>
<div id="2" style="display:none;">
<table style="border-right: #cccccc 1px solid; border-top: #cccccc 1px solid; border-left: #cccccc 1px solid; border-bottom: #cccccc 1px solid; background-image:url(images/b1.jpg); width:580px; height:300px" border="0" cellpadding="0" cellspacing="0"><tr>
<td><a href="FlowerView.aspx?id=37"><img src="images/37.jpg" width="230" height="290" style="border:0" alt=""/></a></td></tr>
</table>
</div>
<div id="4" style="display:none;">
<td width="95" align="center" style="height: 11px"><font color="#FFFFFF"><a href="#" class=" A1" onmouseover="javascript:show('1')">精美礼品</a></font></td>
<td width="95" align="center" style="height: 11px"><a href="#" class=" A1" onmouseover="javascript:show('2')">最新上市</a></td>
<td width="95" align="center" style="height: 11px"><a href="#" class=" A1" onmouseover="javascript:show('3')">热卖鲜花</a></td>
<td width="95" align="center" style="height: 11px"><a href="#" class=" A1" onmouseover="javascript:show('4')">免费玩具</a></td>
</tr>
</table>
</td> 展开
4个回答
展开全部
<script type="text/javascript">
var n =0;
function changeimg(){
var array = new Array("图片的名字1","图片的名字2","图片的名字3");
if(n==array.length)
{
n = 0;
}
document.getElementById("img").src = array[n];
n = n+1;
setTimeout("changeimg()",1000);
}
</script>
<body onload="changeimg()">
<img src="第一张图片图片名字" width="宽度" height="高度" id="img"/>
</body>
//这是我刚刚写的,希望对你有帮助,如果不好,也希望能作为参考,嘿嘿
var n =0;
function changeimg(){
var array = new Array("图片的名字1","图片的名字2","图片的名字3");
if(n==array.length)
{
n = 0;
}
document.getElementById("img").src = array[n];
n = n+1;
setTimeout("changeimg()",1000);
}
</script>
<body onload="changeimg()">
<img src="第一张图片图片名字" width="宽度" height="高度" id="img"/>
</body>
//这是我刚刚写的,希望对你有帮助,如果不好,也希望能作为参考,嘿嘿
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
var num=0;
var num2=3;
function changePic(){
if(num>2){
num=1
}
else{
num++;
}
document.getElementById("L"+num).style.display="block";
document.getElementById("L"+num2).style.display="none";
num2=num;
var timer=setTimeout("changePic()",3000);
}
我写的,可能麻烦点,但肯定能实现。层ID是L1,L2,L3。3个层图片循环显示
var num2=3;
function changePic(){
if(num>2){
num=1
}
else{
num++;
}
document.getElementById("L"+num).style.display="block";
document.getElementById("L"+num2).style.display="none";
num2=num;
var timer=setTimeout("changePic()",3000);
}
我写的,可能麻烦点,但肯定能实现。层ID是L1,L2,L3。3个层图片循环显示
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
http://www.recoding.it/wp-content/uploads/demos/showcase-demo.htm
jQuery插件:Showcase,轻松搞定
jQuery插件:Showcase,轻松搞定
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询