如何在HTML实现图片无间隙循环滚动
用JS也可以..主要是可以无间隙循环滚动就可以了如果是JS再请说明一下使用方法..小弟刚入门..什么都不懂..谢谢了....
用JS也可以..主要是可以无间隙循环滚动就可以了
如果是JS再请说明一下使用方法..
小弟刚入门..什么都不懂..谢谢了. 展开
如果是JS再请说明一下使用方法..
小弟刚入门..什么都不懂..谢谢了. 展开
2个回答
展开全部
<div id="demo" style="overflow:hidden;width:670px;color:#ffffff;">
<table cellpadding="0" cellspacing="0" border="0">
<tr><td id="demo1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td><img src="http://www.haao.cn/logo.gif" width="88"></td>
<td><img src="http://www.haao.cn/logo.gif" width="88"></td>
<td><img src="http://www.haao.cn/logo.gif" width="88"></td>
<td><img src="http://www.haao.cn/logo.gif" width="88"></td>
<td><img src="http://www.haao.cn/logo.gif" width="88"></td>
</tr>
</table>
</td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=1//速度数值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo.scrollLeft<=0)
demo.scrollLeft+=demo2.offsetWidth
else{
demo.scrollLeft--
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
<table cellpadding="0" cellspacing="0" border="0">
<tr><td id="demo1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
<td><img src="http://www.haao.cn/logo.gif" width="88"></td>
<td><img src="http://www.haao.cn/logo.gif" width="88"></td>
<td><img src="http://www.haao.cn/logo.gif" width="88"></td>
<td><img src="http://www.haao.cn/logo.gif" width="88"></td>
<td><img src="http://www.haao.cn/logo.gif" width="88"></td>
</tr>
</table>
</td>
<td id="demo2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=1//速度数值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo.scrollLeft<=0)
demo.scrollLeft+=demo2.offsetWidth
else{
demo.scrollLeft--
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
展开全部
<SCRIPT language=JavaScript>
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = 'images2005/03/1.gif' 图片路径
Pic[1] = 'images2005/03/2.gif'
Pic[2] = 'images2005/03/3.gif'
Pic[3] = 'images2005/03/4.gif'
Pic[4] = 'images2005/03/5.gif'
Pic[5] = 'images2005/03/6.gif'
Pic[6] = 'images2005/03/7.gif'
Pic[7] = 'images2005/03/8.gif'
Pic[8] = 'images2005/03/9.gif'
Pic[9] = 'images2005/03/10.gif'
// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad = new Image();
preLoad.src = Pic;
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
</SCRIPT>
将BODY改为 <BODY onload=runSlideShow()>
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = 'images2005/03/1.gif' 图片路径
Pic[1] = 'images2005/03/2.gif'
Pic[2] = 'images2005/03/3.gif'
Pic[3] = 'images2005/03/4.gif'
Pic[4] = 'images2005/03/5.gif'
Pic[5] = 'images2005/03/6.gif'
Pic[6] = 'images2005/03/7.gif'
Pic[7] = 'images2005/03/8.gif'
Pic[8] = 'images2005/03/9.gif'
Pic[9] = 'images2005/03/10.gif'
// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad = new Image();
preLoad.src = Pic;
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
</SCRIPT>
将BODY改为 <BODY onload=runSlideShow()>
参考资料: http://www.bluefate.cn
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询