文字自动循环滚动 的js 函数
来源:互联网 发布:mac不知管理员名称密码 编辑:程序博客网 时间:2024/05/21 19:22
<script language='javascript'>
<!--
/********************************/
/* 文字自动循环滚动 */
/* IE6 FF1.0.4 */
/* 不支持xhtml声明的文档 */
/********************************/
//*********不要修改这部分***************
//scrollBodyId: String 内部滚动div的id
//scrollBoxId: String 外面限制div的id
//showHeight: Int 限制显示高度
//showWidth: Int 限制显示宽度
//lineHeight: Int 每行的高度
//stopTime: Int 间隔停止的时间(毫秒)
//speed: Int 滚动速度(毫秒,越小越快)
var ScrollObj = function(scrollBodyId,scrollBoxId,showHeight,showWidth,lineHeight,stopTime,speed) {
this.obj = document.getElementById(scrollBodyId);
this.box = document.getElementById(scrollBoxId);
this.style = this.obj.style;
this.defaultHeight = this.obj.offsetHeight;
this.obj.innerHTML += this.obj.innerHTML;
this.obj.style.position = "relative";
this.box.style.height = showHeight;
this.box.style.width = showWidth;
this.box.style.overflow = "hidden";
this.scrollUp = doScrollUp;
this.stopScroll = false;
this.curLineHeight = 0;
this.lineHeight = lineHeight;
this.curStopTime = 0;
this.stopTime = stopTime;
this.speed = speed;
this.style.top = lineHeight;
this.object = scrollBodyId + "Object";
eval(this.object + "=this");
setInterval(this.object+".scrollUp()",speed);
this.obj.onmouseover=new Function(this.object+".stopScroll=true");
this.obj.onmouseout=new Function(this.object+".stopScroll=false");
}
function doScrollUp() {
if( this.stopScroll == true )
return;
this.curLineHeight += 1;
if( this.curLineHeight >= this.lineHeight ) {
this.curStopTime += 1;
if( this.curStopTime >= this.stopTime ) {
this.curLineHeight = 0;
this.curStopTime = 0;
}
}
else {
this.style.top = parseInt(this.style.top) - 1;
if( -parseInt(this.style.top) >= this.defaultHeight ) {
this.style.top = 0;
}
}
}
//***************这以上不要修改******************
//-->
</script>
调用方法:
<div id="scroollBox" style="border:0px ; ">
<div id="scroollBody">阿斯科利的积分卡士大夫
</div>
</div>
<script language="javascript" type="text/javascript">
<!--
//var sample = new ScrollObj(String 内部滚动div的id, String 外面限制div的id, Int 限制显示高度, Int 限制显示宽度, Int 每行的高度, Int 间隔停止的时间(毫秒), Int 滚动速度(毫秒,越小越快));
var sample = new ScrollObj("scroollBody", "scroollBox", 110, 560, 111, 50, 10);
// -->
</script>
左右滚动 js:
var speed3=25//速度数值越大速度越慢
demo2.innerHTML = demo1.innerHTML
function Marquee()
{
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar = setInterval(Marquee, speed3)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout = function() { MyMar = setInterval(Marquee, speed3) }
调用 方法:
<DIV id=demo style="OVERFLOW: hidden; WIDTH: 100%; COLOR: #ffffff">
<TABLE cellSpacing=0 cellPadding=0 align=left border=0 cellspace="0">
<TBODY>
<TR>
<TD id=demo1 vAlign=top><table width="1710" height="116" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="171" background="images/pic_bg.jpg"><div align="center">1</div></td>
<td width="171" background="images/pic_bg.jpg"><div align="center">
<p>2</p>
</div></td>
<td width="171" background="images/pic_bg.jpg"><div align="center">3</div></td>
<td width="171" background="images/pic_bg.jpg"><div align="center">4</div></td>
<td width="171" background="images/pic_bg.jpg"><div align="center">5</div></td>
<td width="171" background="images/pic_bg.jpg"><div align="center">6</div></td>
<td width="171" background="images/pic_bg.jpg"><div align="center">7</div></td>
<td width="171" background="images/pic_bg.jpg"><div align="center">8</div></td>
<td width="171" background="images/pic_bg.jpg"><div align="center">9</div></td>
<td width="171" background="images/pic_bg.jpg"><div align="center">10</div></td>
</tr>
</table></TD>
<TD id=demo2 vAlign=top>
</TD></TR></TBODY></TABLE></DIV>
- 文字自动循环滚动 的js 函数
- 文字自动循环滚动js函数
- js文字循环滚动
- JS实现div内部的文字或图片自动循环滚动
- JS实现div内部的文字或图片自动循环滚动
- js文字循环滚动效果
- 滚动的文字js
- js图片文字上下自动滚动
- 滚动文字的实现js
- 滚动视图的自动循环滚动
- 文字循环向上滚动
- 文字标签循环滚动
- 文字左右循环滚动
- 文字循环向上滚动
- Ulead GIF Animator制作滚动的文字条幅,循环滚动
- RICHTEXTBOX中实现文字的自动滚动
- 文字滚动后自动停止的特效
- 一段按页自动滚动文字或图片的Js代码
- 正则表达式
- Java中正则表达式使用方法详解
- 软件测试过程模型的种类之-------------X模型(转)
- 电子商务信用如何提高?
- 修改ASPxPivotGrid1的ShowColumnGrandTotals,显示我想要的数据算法非合计(例:平均)
- 文字自动循环滚动 的js 函数
- 软件测试过程模型的种类之--------------前置测试模型(转)
- abap call java
- asp.net判断输入文字是否是数字
- Oracle数据库表和视图对象简介
- 软件测试模型的使用(转)
- Apply wininet dbg version to an app build with vs2008.
- Oracle常用命令整理
- 关于日期知识的整理