在网页中插入两行相同的图片滚动代码后两个图片列都不滚动了……但一个可以滚动,求高手指教
或者能让两行图片在首页上滚动,不同代码也行,要鼠标移上去图片就能停止的,我的代码如下<styletype="text/css"><!--#demo{background:...
或者能让两行图片在首页上滚动,不同代码也行,要鼠标移上去图片就能停止的,
我的代码如下
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 690px;
}
#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="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=16"
target="_blank"><img src="http://xxxxxxxxxxxx/xilie/x01.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=40"><img
src="http://xxxxxxxxxxxx/xilie/x02.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=41"><img
src="http://xxxxxxxxxxxx/xilie/x03.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=15"><img
src="http://xxxxxxxxxxxx/xilie/x04.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=38"><img
src="http://xxxxxxxxxxxx/xilie/x05.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=39"><img
src="http://xxxxxxxxxxxx/xilie/x06.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=37"><img
src="http://xxxxxxxxxxxx/xilie/x07.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=42"><img
src="http://xxxxxxxxxxxx/xilie/x08.jpg" border="0" /></a>
</div>
<div id="demo2"></div>
</div>
</div>
<script>
<!--
var speed=30; //数字越大速度越慢
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: 690px;
}
#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="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=16"
target="_blank"><img src="http://xxxxxxxxxxxx/xilie/x01.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=40"><img
src="http://xxxxxxxxxxxx/xilie/x02.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=41"><img
src="http://xxxxxxxxxxxx/xilie/x03.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=15"><img
src="http://xxxxxxxxxxxx/xilie/x04.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=38"><img
src="http://xxxxxxxxxxxx/xilie/x05.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=39"><img
src="http://xxxxxxxxxxxx/xilie/x06.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=37"><img
src="http://xxxxxxxxxxxx/xilie/x07.jpg" border="0" /></a>
<a href="http://xxxxxxxxxxxx/portal.php?mod=topic&topicid=42"><img
src="http://xxxxxxxxxxxx/xilie/x08.jpg" border="0" /></a>
</div>
<div id="demo2"></div>
</div>
</div>
<script>
<!--
var speed=30; //数字越大速度越慢
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> 展开
2个回答
展开全部
滚动代码1
<div id="gpic" style="overflow:hidden; width:400px; height:182px;">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td id="gpic1" valign="top" align="center"><table width="974" height="113" border="0" align='center' cellpadding="0" cellspacing="0">
<tr>
<td valign='top' bgcolor="#FF0000"> </td>
<td valign='top' bgcolor="#0066CC"> </td>
<td valign='top' bgcolor="#6600CC"> </td>
<td valign='top' bgcolor="#FF00CC"> </td>
</tr>
</table></td>
<td id="gpic2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=30
gpic2.innerHTML=gpic1.innerHTML
function Marquee(){
if(gpic2.offsetWidth-gpic.scrollLeft<=0)
gpic.scrollLeft-=gpic1.offsetWidth
else{
gpic.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
gpic.onmouseover=function() {clearInterval(MyMar)}
gpic.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
滚动代码2
<div id="hpic" style="overflow:hidden; width:400px; height:182px;">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td id="hpic1" valign="top" align="center"><table width="974" height="113" border="0" align='center' cellpadding="0" cellspacing="0">
<tr>
<td valign='top' bgcolor="#FF0000"> </td>
<td valign='top' bgcolor="#0066CC"> </td>
<td valign='top' bgcolor="#6600CC"> </td>
<td valign='top' bgcolor="#FF00CC"> </td>
</tr>
</table></td>
<td id="hpic2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=30
hpic2.innerHTML=hpic1.innerHTML
function Marquee(){
if(hpic2.offsetWidth-hpic.scrollLeft<=0)
hpic.scrollLeft-=hpic1.offsetWidth
else{
hpic.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
hpic.onmouseover=function() {clearInterval(MyMar)}
hpic.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
直接复制以上代码另存为一个html文件,,运行即可
<div id="gpic" style="overflow:hidden; width:400px; height:182px;">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td id="gpic1" valign="top" align="center"><table width="974" height="113" border="0" align='center' cellpadding="0" cellspacing="0">
<tr>
<td valign='top' bgcolor="#FF0000"> </td>
<td valign='top' bgcolor="#0066CC"> </td>
<td valign='top' bgcolor="#6600CC"> </td>
<td valign='top' bgcolor="#FF00CC"> </td>
</tr>
</table></td>
<td id="gpic2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=30
gpic2.innerHTML=gpic1.innerHTML
function Marquee(){
if(gpic2.offsetWidth-gpic.scrollLeft<=0)
gpic.scrollLeft-=gpic1.offsetWidth
else{
gpic.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
gpic.onmouseover=function() {clearInterval(MyMar)}
gpic.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
滚动代码2
<div id="hpic" style="overflow:hidden; width:400px; height:182px;">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td id="hpic1" valign="top" align="center"><table width="974" height="113" border="0" align='center' cellpadding="0" cellspacing="0">
<tr>
<td valign='top' bgcolor="#FF0000"> </td>
<td valign='top' bgcolor="#0066CC"> </td>
<td valign='top' bgcolor="#6600CC"> </td>
<td valign='top' bgcolor="#FF00CC"> </td>
</tr>
</table></td>
<td id="hpic2" valign="top"></td>
</tr>
</table>
</div>
<script>
var speed=30
hpic2.innerHTML=hpic1.innerHTML
function Marquee(){
if(hpic2.offsetWidth-hpic.scrollLeft<=0)
hpic.scrollLeft-=hpic1.offsetWidth
else{
hpic.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
hpic.onmouseover=function() {clearInterval(MyMar)}
hpic.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
直接复制以上代码另存为一个html文件,,运行即可
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
TableDI
2024-07-18 广告
2024-07-18 广告
作为上海悉息信息科技有限公司的一员,我们专注于提供高效的数据处理解决方案。对于多个文件表格的合并需求,我们通常采用专业的数据整合技术,确保数据的准确性和一致性。通过精确匹配表格字段和格式,我们能够快速、准确地将多个表格合并成一个,为用户提供...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询