JS写的一个图片轮换特效,每次一张,带左右箭头按钮。
展开全部
<script>
var picarr=new Array("1.jpg","2.jpg","3.jpg");
var mypoint=-1;
function changepic(myflag)
{
if(myflag<0)
{
mypoint=mypoint-1;
if (mypoint<0) { mypoint=picarr.length-1;}
}
else
{
mypoint=mypoint+1;
if (mypoint==picarr.length) { mypoint=0;}
}
document.getElementById("pic").src=picarr[mypoint];
}
</script>
<body style="text-align:center;" onload="changepic(0);">
<div style="width:810px;background-color:#eee">
<span onclick="changepic(-1);" onmousemove="this.style.color='red';" onmouseout="this.style.color='blue';" style="cursor: hand">《-LastOne </span>
<img id=pic border="0" width=600 style="text-align:center;vertical-align:middle;"/>
<span onclick="changepic(0);" style="cursor: hand;" onmousemove="this.style.color='red';" onmouseout="this.style.color='blue';" > NextOne-》</span>
</div>
<body>
var picarr=new Array("1.jpg","2.jpg","3.jpg");
var mypoint=-1;
function changepic(myflag)
{
if(myflag<0)
{
mypoint=mypoint-1;
if (mypoint<0) { mypoint=picarr.length-1;}
}
else
{
mypoint=mypoint+1;
if (mypoint==picarr.length) { mypoint=0;}
}
document.getElementById("pic").src=picarr[mypoint];
}
</script>
<body style="text-align:center;" onload="changepic(0);">
<div style="width:810px;background-color:#eee">
<span onclick="changepic(-1);" onmousemove="this.style.color='red';" onmouseout="this.style.color='blue';" style="cursor: hand">《-LastOne </span>
<img id=pic border="0" width=600 style="text-align:center;vertical-align:middle;"/>
<span onclick="changepic(0);" style="cursor: hand;" onmousemove="this.style.color='red';" onmouseout="this.style.color='blue';" > NextOne-》</span>
</div>
<body>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询