dreamweaver中marquee标签怎么实现最后一张图片紧接第一张图片连续循环~
2个回答
2013-08-23
展开全部
marquee图片无缝滚动先了解一下对象的几个的属性:innerHTML: 设置或获取位于对象起始和结束标签内的 HTMLscrollHeight: 获取对象的滚动高度。scrollLeft: 设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离scrollTop: 设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离scrollWidth: 获取对象的滚动宽度offsetHeight: 获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度offsetLeft: 获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算左侧位置offsetTop: 获取对象相对于版面或由 offsetTop 属性指定的父坐标的计算顶端位置offsetWidth: 获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的宽度-----------------------------------------------------------------------图片向上无缝滚动<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
height: 100px;
text-align: center;
float: left;
}
#demo img {
border: 3px solid #F2F2F2;
display: block;
}
-->
</style>
向上滚动
<div id="demo">
<div id="demo1">
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div><script>
<!--
var speed=10; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML; //克隆demo1为demo2
function Marquee(){
if(tab2.offsetTop-tab.scrollTop<=0)//当滚动至demo1与demo2交界时
tab.scrollTop-=tab1.offsetHeight //demo跳到最顶端
else{
tab.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};//鼠标移上时清除定时器达到滚动停止的目的
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};//鼠标移开时重设定时器
-->
</script>------------------------------------------------------------图片向下无缝滚动<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
height: 100px;
text-align: center;
float: left;
}
#demo img {
border: 3px solid #F2F2F2;
display: block;
}
-->
</style>
向下滚动
<div id="demo">
<div id="demo1">
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div><script>
<!--
var speed=10; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML; //克隆demo1为demo2
tab.scrollTop=tab.scrollHeight
function Marquee(){
if(tab1.offsetTop-tab.scrollTop>=0)//当滚动至demo1与demo2交界时
tab.scrollTop+=tab2.offsetHeight //demo跳到最顶端
else{
tab.scrollTop--
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};//鼠标移上时清除定时器达到滚动停止的目的
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};//鼠标移开时重设定时器
-->
</script>--------------------------------------------------------图片向左无缝滚动<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
向左滚动
<div id="demo">
<div id="indemo">
<div id="demo1">
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div>
</div><script>
<!--
var speed=10; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab2.offsetWidth-tab.scrollLeft<=0)
tab.scrollLeft-=tab1.offsetWidth
else{
tab.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script>------------------------------------------------------图片向右无缝滚动<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
向右滚动
<div id="demo">
<div id="indemo">
<div id="demo1">
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div>
</div><script>
<!--
var speed=10; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab.scrollLeft<=0)
tab.scrollLeft+=tab2.offsetWidth
else{
tab.scrollLeft--;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script>
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
height: 100px;
text-align: center;
float: left;
}
#demo img {
border: 3px solid #F2F2F2;
display: block;
}
-->
</style>
向上滚动
<div id="demo">
<div id="demo1">
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div><script>
<!--
var speed=10; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML; //克隆demo1为demo2
function Marquee(){
if(tab2.offsetTop-tab.scrollTop<=0)//当滚动至demo1与demo2交界时
tab.scrollTop-=tab1.offsetHeight //demo跳到最顶端
else{
tab.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};//鼠标移上时清除定时器达到滚动停止的目的
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};//鼠标移开时重设定时器
-->
</script>------------------------------------------------------------图片向下无缝滚动<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
height: 100px;
text-align: center;
float: left;
}
#demo img {
border: 3px solid #F2F2F2;
display: block;
}
-->
</style>
向下滚动
<div id="demo">
<div id="demo1">
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div><script>
<!--
var speed=10; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML; //克隆demo1为demo2
tab.scrollTop=tab.scrollHeight
function Marquee(){
if(tab1.offsetTop-tab.scrollTop>=0)//当滚动至demo1与demo2交界时
tab.scrollTop+=tab2.offsetHeight //demo跳到最顶端
else{
tab.scrollTop--
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};//鼠标移上时清除定时器达到滚动停止的目的
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};//鼠标移开时重设定时器
-->
</script>--------------------------------------------------------图片向左无缝滚动<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
向左滚动
<div id="demo">
<div id="indemo">
<div id="demo1">
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div>
</div><script>
<!--
var speed=10; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab2.offsetWidth-tab.scrollLeft<=0)
tab.scrollLeft-=tab1.offsetWidth
else{
tab.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script>------------------------------------------------------图片向右无缝滚动<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
向右滚动
<div id="demo">
<div id="indemo">
<div id="demo1">
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
<a href="#"><img src=" http://www.cnrui.cn/other/link/Clear_logo.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div>
</div><script>
<!--
var speed=10; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab.scrollLeft<=0)
tab.scrollLeft+=tab2.offsetWidth
else{
tab.scrollLeft--;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script>
博思aippt
2024-07-20 广告
2024-07-20 广告
博思AIPPT是基于ai制作PPT的智能在线工具,它提供了4种AI制作PPT的方式,包括AI生成大纲、AI直接生成PPT、文本生成PPT、AI提炼word文档生成PPT,一站式集成多种AI生成PPT的方式,可满足办公用户的不同需求和使用场景...
点击进入详情页
本回答由博思aippt提供
展开全部
<div id="scroll_div" style="overflow: hidden; width: 770px; HEIGHT: 80px;" align="center">
<table>
<tr>
<td id="scroll_begin" width="100%">
<!--这里开始输入要滚动的页面--图片链接修改为自己的图片>
<table width="200" height="90" border="0" align="center" cellpadding="10" cellspacing="0">
<tr>
<td width="20"><img src="1.jpg" width="100" height="100"></td>
<td width="20"><img src="1.jpg" width="100" height="100"></td>
<td width="20"><img src="1.jpg" width="100" height="100"></td>
<td width="20"><img src="1.jpg" width="100" height="100"></td>
<td width="20"><img src="1.jpg" width="100" height="100"></td>
<td width="20"><img src="1.jpg" width="100" height="100"></td>
<td width="20"><img src="1.jpg" width="100" height="100"></td>
<tr>
</table>
<!--结束在这里-->
</td>
<td id=scroll_end></td>
</tr>
</table>
<script>
var speed=60
scroll_end.innerHTML=scroll_begin.innerHTML
function Marquee(){
if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)
scroll_div.scrollLeft-=scroll_begin.offsetWidth
else{
scroll_div.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
scroll_div.onmouseover=function() {clearInterval(MyMar)}
scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
</div>
效果就是连续循环,最后一张紧接着第一张:
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询