Html实现四张图⽚滚动的源码
<title>Document</title>
</head>
<body OnLoad="swapPic()">
<script language="javascript" type="text/javascript">
var ranl = 0;
var useRand = 0;
images = new Array;
images[1] = new Image();
images[1].src = "images/pic.jpg";
images[2] = new Image();
images[2].src = "images/pic1.jpg";
images[3] = new Image();
images[3].src = "images/pic3.jpg";
images[4] = new Image();
images[4].src = "images/pic4.jpg";
function swapPic(){
var imgnum = images.length-1;
do{
var randnum = Math.random();
randl = und((imgnum-1)*randnum)+1;
}while(randl==useRand);
useRand = randl;
document.randimg.src = images[useRand].src
setTimeout('swapPic()',2000);
}
</script>
html如何设置图片滚动<img name ="randimg" src="images/pic.jpg">
</body>
<ml>
使⽤时候直接替换掉图⽚地址就Ok
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论