//&nbs
p; 描述 : 无间断滚动字幕
// 版本 : 2.0
// 作者 : 宝玉(WebUC.NET)
// 最新更新 :
2004-10-26
// 备 :
<p
ublic:
component>
<public:attach event="oncontentready" onevent="f_In
IT()" />
<public:attach event="on
PRo
PErtychange" onevent="f_PropChange()" />
<public:property n
ame="direction" />
<public:property name="speed" />
<public:property name="delay" />
<public:method NAME="marquee"/>
<public:method NAME="stop"/>
<public:method NAME="start"/>
</public:component>
<script language="JScript">
VAR _oMarqueeContent;
var _oMarquee;
var _speed = 2;
var _
orientation;
var _direction = "up";
var _ContentWidth;
var _ContentH
eight;
var _MarqueeWidth;
var _MarqueeHeight;
var _paddingTop;
var _
FirstNode = 1;
var _count = 0;
var _timer = null;
var _pause = false;
var _marqueeInterval = 100; // 滚动间隔
var _delayInterval = 2000; // 标题显示延迟间隔
//+----------------------------------------------------------------------------
// Function: f_Init
// Description: 初始化
// Parameters: null
// Returns: null
//-----------------------------------------------------------------------------
function f_Init()
{
_oMarquee = document.createElement("div");
_oMarqueeContent = document.createElement("span");
_oMarqueeContent.innerHT
ML = element.innerHTML;
_oMarquee.appendChild(_oMarqueeContent);
element.innerHTML = "";
element.appendChild(_oMarquee);
if(speed
== null) speed = _speed;
speed = parseInt(speed);
if(!speed) speed =_speed;
if(delay == null) delay = _delayInterval;
delay = parseInt(delay);
if(!delay) delay = _delayInterval;
if(direction == null) direction =_direction;
direction = direction.toLowerCase();
if(direction != "left"
&& direction != "right" && direction != "up" && direction != "down")
direction = _direction;
_orientation= (direction == "left" || direction == "right") ? "horizontal" : "vert
ical"
InitMarquee();
 
;marquee();
}
function InitMarquee()
{
_MarqueeWidth = _oMarquee.offsetWidth;
_MarqueeHeight = _oMarquee.offsetHeight;
_count = _oMarqueeContent.children.length;
_ContentWidth = _oMarqueeContent.offsetWidth;
_ContentHeight = _oMarqueeContent.offsetHeight;
_paddingTop = _oMarquee.offsetTop;
FillMarquee()
_oMarqueeContent.style.position = "relative";
_oMarqueeContent.style.pixelTop = 0;
}
function FillMarquee()
{
var children = _oMarqueeContent.children;
var i = 0;
if (_orientation== "horizontal")
{
while (_oMarqueeContent.offsetWidth < _ContentWidth + _MarqueeWidth)
{
_oMarqueeContent.appendChild(children[
i++].cloneNode(true));
}
}
else
{
while (_oMarqueeContent.offsetHeight < _ContentHeight + _MarqueeHeight)
{
_oMarqueeContent.appendChild(children[i++].cloneNode(true));
}
}
}
function marquee()
{
if (_pause)
return;
switch(direction)
{
case "up":
_oMarqueeContent.style.pixelTop -= speed;
if(Math.abs(_oMarqueeContent.style.pixelTop + _ContentHeight + _paddingTop) < speed)
_oMarqueeContent.style.pixelTop = 0;
if (Math.abs(_oMarqueeContent.children[_firstNode].offsetTop) - _paddingTop < speed)
{
_firstNode++;
if (_firstNode >= _count)
_firstNode = 0;
_timer = window.setTimeout(
uniqueID + ".marquee()", _delayInterval);
}
else
_timer = window.setTimeout(uniqueID + ".marquee()", _marqueeInterval);
break;
}
}
function stop()
{
clearTimer();
_pause = true;
}
function start()
{
if (_timer != null)
clearTimer();
_pause = false;
marquee();
}
function clearTimer()
{
window.clearTimeout(_timer);
_timer = null;
}
//
// Cancels an event
//
function f_CancelEvent()
{
event.returnValue = false;
}
//
// A property changed
//
function f_PropChange()
{
switch (event.propertyName)
{
default:
f_
redraw();
break;
}
}
//
// Forces a redraw of the control
//
function f_Redraw()
{
}
</script>
<style>
body,td{
font-
Size:9pt;
}
.marquee{
overflow-y:hidden;word-break:break-all;padding:10px;
behavior:url('marquee.htc');
}
.marquee div{
padding-bottom:10px;
}
</style>
无间断滚动<br />
每个标题间有停留<br />
鼠标移入停止,鼠标移出继续滚动<br />
<span style="height:100px;width:200px;border:1px solid black;" delay="3000" class="marquee" onmouseover="this.stop()" onmouseout="this.start()">
<div><a
href="http://www.webuc.net" t
arget="_blank">1. 宝玉(http://www.webuc.net)作品</a></div>
<div><a href="http://www.webuc.net" target="_blank">2. 强强联手,助推上海建筑领域信息化
建设</a> </div>
<div><a href="http://www.webuc.net" target="_blank">3. 广联达清单招标投标策略研讨会——河南站
圆满成功</a> </div>
<div><a href="http://www.webuc.net" target="_blank">4.
足球友谊赛:河北
电建一
公司 VS 广联达石家庄分公司</a> </div>
<div><a href="http://www.webuc.net" target="_blank">5. 广联达——清单算量软件 GCL7.0新版出炉!</a> </div>
<div><a href="http://www.webuc.net" target="_blank">6. 喜报:广联达公司顺利通过ISO9000
质量管理体系三年复审</a> </div>
<div><a href="http://www.webuc.net" target="_blank">7. 广联达-清单整体解决
方案在北京求实造价咨询公司的成功应用</a> </div>
<div><a href="http://www.webuc.net" target="_blank">8. 广联达-施工项目
成本管
理系统(GCM)在荣尊堡工程中的应用</a> </div>
<div><a href="http://www.webuc.net" target="_blank">9. 广联达-工程概预算软件在北京建工集团总公司东方广场工程的应用</a> </div>
<div><a href="http://www.webuc.net" target="_blank">10. as
DFfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff</a> </div>
</span>
<script>
</script>