<HTML><HEAD><TITLE>New Page 1</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1476" name=GENERATOR>
<META content=FrontPage.Editor.Document name=ProgId></HEAD>
<BODY>
<div id="tbmq" style="display:none"><table width="393" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="33" height="30"> </td>
<td width="354">1</td>
</tr>
<tr>
<td height="30"> </td>
<td>2</td>
</tr>
<tr>
<td height="30"> </td>
<td>3</td>
</tr>
<tr>
<td height="30"> </td>
<td>4</td>
</tr>
<tr>
<td height="30"> </td>
<td>5</td>
</tr>
<tr>
<td height="30"> </td>
<td>6</td>
</tr>
<tr>
<td height="30"> </td>
<td>7</td>
</tr>
<tr>
<td height="30"> </td>
<td>8</td>
</tr>
<tr>
<td height="30"> </td>
<td>9</td>
</tr>
<tr>
<td height="30"> </td>
<td>0</td>
</tr>
</table>
</div>
<script>
//无间断滚动功能开始
document.write('<div id="icefable1" width="100%">'+'</div>');marqueesHeight=150;
stopscroll=false;
icefable1.scrollTop=0;with(icefable1){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}items=1; preTop=0; currentTop=150; OcurrentTop=currentTop; stoptime=0; staytime=1; timestep=70;
icefable1.innerHTML=tbmq.innerHTML+tbmq.innerHTML;function init_srolltext(){
icefable1.scrollTop=0;
setInterval("scrollUp()",timestep);
}init_srolltext();function scrollUp(){
if(stopscroll==true) return;
currentTop++;
if(currentTop==OcurrentTop+1)
{
stoptime++;
currentTop--;
if(stoptime==staytime)
{
currentTop=0;
stoptime=0;
}
}
else {
preTop=icefable1.scrollTop;
icefable1.scrollTop++;
if(preTop==icefable1.scrollTop){
icefable1.scrollTop=OcurrentTop*(items-1);
icefable1.scrollTop++;
}
}
}
</script></BODY></HTML>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1476" name=GENERATOR>
<META content=FrontPage.Editor.Document name=ProgId></HEAD>
<BODY>
<div id="tbmq" style="display:none"><table width="393" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="33" height="30"> </td>
<td width="354">1</td>
</tr>
<tr>
<td height="30"> </td>
<td>2</td>
</tr>
<tr>
<td height="30"> </td>
<td>3</td>
</tr>
<tr>
<td height="30"> </td>
<td>4</td>
</tr>
<tr>
<td height="30"> </td>
<td>5</td>
</tr>
<tr>
<td height="30"> </td>
<td>6</td>
</tr>
<tr>
<td height="30"> </td>
<td>7</td>
</tr>
<tr>
<td height="30"> </td>
<td>8</td>
</tr>
<tr>
<td height="30"> </td>
<td>9</td>
</tr>
<tr>
<td height="30"> </td>
<td>0</td>
</tr>
</table>
</div>
<script>
//无间断滚动功能开始
document.write('<div id="icefable1" width="100%">'+'</div>');marqueesHeight=150;
stopscroll=false;
icefable1.scrollTop=0;with(icefable1){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}items=1; preTop=0; currentTop=150; OcurrentTop=currentTop; stoptime=0; staytime=1; timestep=70;
icefable1.innerHTML=tbmq.innerHTML+tbmq.innerHTML;function init_srolltext(){
icefable1.scrollTop=0;
setInterval("scrollUp()",timestep);
}init_srolltext();function scrollUp(){
if(stopscroll==true) return;
currentTop++;
if(currentTop==OcurrentTop+1)
{
stoptime++;
currentTop--;
if(stoptime==staytime)
{
currentTop=0;
stoptime=0;
}
}
else {
preTop=icefable1.scrollTop;
icefable1.scrollTop++;
if(preTop==icefable1.scrollTop){
icefable1.scrollTop=OcurrentTop*(items-1);
icefable1.scrollTop++;
}
}
}
</script></BODY></HTML>
解决方案 »
- 求教一个匿名函数传参问题。
- 高手进来帮我看看呀,谢谢了
- 获取div
- 一网站 要在北京打开时跳转到别的页面,其他城市不跳转 求此JS代码(最好不要用到IP库)!
- 元素.attachEvent('onfocus',new function(){});执行顺序问题,高手来看看
- 正则表达式 如何匹配两个标记之间的值
- 请教各位我这句话错在哪儿了??
- 我在进入一个页面时要检查权限,当没有权限时先弹一个mseeage然后页面跳转,但现在只能跳转,有没有解决的方法
- 如何在当前网页上播放wav文件??详情请入内
- 在jquery 1.11.1版本中,如何实现jquery 1.9以下版本里面的toggle功能?
- 求助:做了个表格单元行动态增加与删除的JS,可删除时出问题
- 求教高手一个问题
先谢谢了,不知可否解释一下大概得意思(我js不是很好)
因为我还需要一个横向滚动的例子,希望能给出另一个代码
用iframe(设置好宽高)导入到正常页面中<HTML><HEAD><TITLE>show</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT language=JavaScript>
<!--//
var x = 0, limdex = 800;
var time_stamp=null,srcPic=null,flag=false,time1_stamp=null;function scrollit() {
if (x < limdex & x >= 0 ) {scroll(x,0); x = x + 2;}
else if (x < 0) {x = limdex;}else {x=0;}
}function stopscroll() {
clearInterval(time_stamp);
clearInterval(time1_stamp);
srcPic=event.srcElement;
time1_stamp = setInterval("showit()",360);
}function startscroll() {
clearInterval(time_stamp);
clearInterval(time1_stamp);
time_stamp = setInterval("scrollit()",60);//speed
if (srcPic!=null){
srcPic.style.border="0"
}
}function showit(){
if (flag){
srcPic.style.border = "1 solid #CC6600";
flag=false;
}else{
srcPic.style.border = "1 solid white";
flag=true;
}
}//-->
</SCRIPT><META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0 onload=startscroll()
marginheight="0" marginwidth="0">
<table border="0" cellpadding="0" cellspacing="5">
<tr>
<td width="90"><img src="cn/image/image_show/1/pp9.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/1/qdda2.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/1/qdda3.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/1/qdda4.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/1/qdda5.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/1/qdda6.jpg"></td>
<td width="90"><img src="cn/image/image_show/hotel1.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/1/qdda7.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/jst02.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/qing3.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/zhushan01.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/zhushan02.jpg" width="90" height="70"></td>
<td width="90"><img src="cn/image/image_show/1/qdda8.jpg"></td>
<td width="90"><img src="cn/image/image_show/1/qing3.jpg"></td>
<td width="90"> </td>
</tr>
</table>
</BODY></HTML>
<div id="tbmq" style="display:none">中的table事实上是隐藏的,只是为了方便可视化编辑和程序代码的嵌入;
真正滚动的是
document.write('<div id="icefable1" width="100%">'+'</div>');
中的内容;
大体原理是利用层的scrollTop属性实现滚动效果
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY><table width="499" border="1" cellpadding="0" cellspacing="0" bordercolor="#CC6600">
<tr>
<td width="495">
<div id=demo style=overflow:hidden;height:70;width:400>
<div id=demo1>
<a href='' target='_blank'>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa </a><br>
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb<br>
ccccccccccccccccccccccccccccccccccccccccccccccccccc<br>
ddddddddddddddddddddddddddddddddddddddddddddddddddd<br>
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee<br>
fffffffffffffffffffffffffffffffffffffffffffffffffff<br>
</div>
<div id=demo2></div>
</div>
<script>
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee()
{
if(demo2.offsetTop-demo.scrollTop<=0)
demo.scrollTop-=demo1.offsetHeight
else
{
demo.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script> </td>
</tr>
</table>
</BODY>
</HTML>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1476" name=GENERATOR>
<META content=FrontPage.Editor.Document name=ProgId></HEAD>
<BODY>
<div id="tbmq" style="display:none"><table width="300" border="1" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="33" height="30"> </td>
<td width="354">1</td>
</tr>
<tr>
<td height="30"> </td>
<td>2</td>
</tr>
<tr>
<td height="30"> </td>
<td>3</td>
</tr>
<tr>
<td height="30"> </td>
<td>4</td>
</tr>
<tr>
<td height="30"> </td>
<td>5</td>
</tr>
<tr>
<td height="30"> </td>
<td>6</td>
</tr>
<tr>
<td height="30"> </td>
<td>7</td>
</tr>
<tr>
<td height="30"> </td>
<td>8</td>
</tr>
<tr>
<td height="30"> </td>
<td>9</td>
</tr>
<tr>
<td height="30"> </td>
<td>0</td>
</tr>
</table>
</div>
<script>
//无间断滚动功能开始
document.write('<div id="icefable1">'+'</div>');marqueesWidth=300;
stopscroll=false;
icefable1.scrollLeft=0;with(icefable1){
style.width=marqueesWidth;
style.height=0;
style.overflowX="hidden";
style.overflowY="visible";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}items=1; preTop=0; currentTop=150; OcurrentTop=currentTop; stoptime=0; staytime=1; timestep=70;
icefable1.innerHTML=tbmq.innerHTML+tbmq.innerHTML;function init_srolltext(){
icefable1.scrollLeft=0;
setInterval("scrollUp()",timestep);
}init_srolltext();function scrollUp(){
if(stopscroll==true) return;
currentTop++;
if(currentTop==OcurrentTop+1)
{
stoptime++;
currentTop--;
if(stoptime==staytime)
{
currentTop=0;
stoptime=0;
}
}
else {
preTop=icefable1.scrollLeft;
icefable1.scrollLeft++;
if(preTop==icefable1.scrollLeft){
icefable1.scrollLeft=OcurrentTop*(items-1);
icefable1.scrollLeft++;
}
}
}
</script></BODY></HTML>
也谢谢 lawyu(雨淋漓)