代码结构:<li class="fir2" id="icefable2">
<div id="box16left2">
<asp:Repeater ID="memberdata" runat="server">
<ItemTemplate>
<div class="fir2a">
<ul>
<li class="fir2_1"><a href="/Agent/Index.aspx?userid=<%#Eval("userid")%>" target="_blank">
<img id="aaa" src="<%#Eval("userphoto").ToString()==""?"/images/pc_deflaut.gif":SW.Common.UitlStr.PicMinfileExtension(Eval("userphoto").ToString())%>"
alt="<%#Eval("FullName") %>" /></a></li>
<li class="fir2_2"><a href="/Agent/Index.aspx?userid=<%#Eval("userid")%>" target="_blank">
<b>
<%#Eval("FullName") %>
</b></a>
<br>
<%# SW.Common.UitlStr.CutString(Eval("honor").ToString(),27,"...")%>
</li>
</ul>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<div id="box16left3">
</div>
</li>
<script type="text/javascript">
var speed=10; //数字越大速度越慢
var tab=document.getElementById("icefable2");
var tab1=document.getElementById("box16left2");
var tab2=document.getElementById("box16left3");
tab2.innerHTML=tab1.innerHTML; //克隆demo1为demo2
function Marquee(){
if(tab2.offsetTop-tab.scrollTop<=0){//当滚动至demo与demo2交界时
tab.scrollTop-=tab1.offsetHeight //demo1跳到最顶端
}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">
<!--
#icefable2 {
overflow:hidden;
height: 110px;
float: left;
}#icefable2 aaa{
border: 3px solid #F2F2F2;
display: block;
}
-->
</style>
运行此代码后,动态获取到的图片只能实现一次翻滚,求解释!!!!【可运行看效果的代码】<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>向上滚动</title>
</head>
<style type="text/css">
<!--
#demo {
overflow:hidden;
height: 100px;
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="" 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>
<body>
</body>
</html>希望哪位大虾能救急一下 !!!
aspx页面上多了这行<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">你把它注释掉就ok了,但是你注视着行必定会引起其他的样式不和,所以最好的方式就是:你在单独写个aspx页面,本页面调用<iframe src="WebForm1.aspx"></iframe>写出来共大家参考一下
body{margin:0px; padding:0px; font-size:12px;}
ul,li{margin:0px; padding:0px; list-style-type:none;}
a:link{font-size:12px; color:#666; text-decoration:none;}
a:visited{font-size:12px; color:#666; text-decoration:none;}
a:hover{font-size:12px; color:#039; text-decoration:underline;}
/*fir start*/
#fir {width:980px; height:180px; margin:auto;}
#fir iframe{width:980px; height:180px; margin:auto; background:none;}
#fir ul li.fir1{width:100%; height:44px; border-bottom:1px #ddd solid; font-family:"微软雅黑"; font-size:24px; color:#039; margin-bottom:10px;}
#fir ul li.fir1 span{float:right; width:80px; height:44px; line-height:44px; text-align:center;}#fir ul li.fir2{width:100%; height:110px; margin:auto; overflow:hidden;}
#fir ul li.fir2 div.fir2a{float:left; width:196px; height:110px;}
#fir ul li.fir2 div.fir2a ul li.fir2_1{float:left; width:80px; text-align:left;}
#fir ul li.fir2 div.fir2a ul li.fir2_1 img{width:75px; height:100px; border:3px #ddd solid;}
#fir ul li.fir2 div.fir2a ul li.fir2_2{float:right; width:102px; text-align:left; line-height:20px; font-size:12px; padding-right:6px;}
#fir ul li.fir2 div.fir2a ul li.fir2_2 a:link{font-size:14px; color:#0041d9; text-decoration:none;}
#fir ul li.fir2 div.fir2a ul li.fir2_2 a:visited{font-size:14px; color:#0041d9; text-decoration:none;}
#fir ul li.fir2 div.fir2a ul li.fir2_2 a:hover{font-size:14px; color:#444; text-decoration:underline;} <div id="fir">
<ul>
<li class="fir1"><span><a href="#"><b>更多></b></a></span><img src="images/title_1.gif"
align="absmiddle" />
金牌经纪人</li>
<li class="fir2" id="icefable2">
<div id="box16left2">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="110">
<asp:Repeater ID="memberdata" runat="server">
<ItemTemplate>
<div class="fir2a">
<ul>
<li class="fir2_1"><a href="/Agent/Index.aspx?userid=<%#Eval("userid")%>" target="_blank">
<img src="<%#Eval("userphoto").ToString()==""?"/images/pc_deflaut.gif":SW.Common.UitlStr.PicMinfileExtension(Eval("userphoto").ToString())%>"
alt="<%#Eval("FullName") %>" /></a></li>
<li class="fir2_2"><a href="/Agent/Index.aspx?userid=<%#Eval("userid")%>" target="_blank">
<b>
<%#Eval("FullName") %>
</b></a>
<br>
<%# SW.Common.UitlStr.CutString(Eval("honor").ToString(),27,"...")%>
</li>
</ul>
</div>
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</table>
</div>
</li>
</ul>
</div><script type="text/javascript">
marqueesHeight=110;
stopscroll=false;
var box16left2Elem = document.getElementById("box16left2");
with(box16left2Elem){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
preTop=0; currentTop=marqueesHeight; stoptime=0;
box16left2Elem.innerHTML+=box16left2Elem.innerHTML;
function init_srolltext(){
box16left2Elem.scrollTop=0;
setInterval("scrollUp()",1);
}init_srolltext();function scrollUp(){
if(stopscroll==true) return;
currentTop+=1;
if(currentTop==marqueesHeight+1)
{
stoptime+=1;
currentTop-=1;
if(stoptime==100)
{
currentTop=0;
stoptime=0;
}
}
else {
preTop=box16left2Elem.scrollTop;
box16left2Elem.scrollTop+=1;
if(preTop==box16left2Elem.scrollTop){
box16left2Elem.scrollTop=marqueesHeight;
box16left2Elem.scrollTop+=1;
}
}
}
init_srolltext();
</script>
Repeater里获取到的是动态的数据,你可以换成你的数据,CSS可以自己调一下,js里marqueesHeight=110;换成你的高度,弄好后,看看效果,是不是你要的?