对联效果
来源:互联网 发布:c语言入门教材 编辑:程序博客网 时间:2024/04/29 13:06
<script language="javascript">
var oCouplet = new Object();
function Couplet(_top, _width, _height, _offset, _delay, _amount) {
this.author = '51JS.COM-ZMM';
this.version = 'Couplet 1.0';
this.top = _top;
this.width = _width;
this.height = _height;
this.offset = _offset;
this.delay = _delay;
this.amount = _amount;
this.drawCouplet = function(_content) {
this.content = _content;
var _client = document.body.clientWidth;
var _css = new String();
_css += 'top: ' + this.top + 'px;';
_css += 'width: ' + this.width + 'px;';
_css += 'height: ' + this.height + 'px;';
_css += 'position: absolute;';
_css += 'font-size: 12px;';
_css += 'border: 1px solid menu;';
_css += 'overflow: auto;'
var _html = new String();
_html += '<div id="oCouplet_left" style="' + _css + 'left: ' + this.offset + 'px;">';
_html += this.content;
_html += '</div>';
_html += '<div id="oCouplet_right" style="' + _css + 'left: ' + (_client - this.width - this.offset) + 'px;">';
_html += this.content;
_html += '</div>';
return _html;
}
this.doScroll = function() {
var _left = document.getElementById('oCouplet_left');
var _right = document.getElementById('oCouplet_right');
var _oTop = parseInt(_left.style.top);
var _nTop = parseInt(document.body.scrollTop) + this.top;
if (_oTop < _nTop) {
if ((_nTop - _oTop) > 0) {
_left.style.top = _right.style.top = _oTop + 1 + 'px';
var oTime = window.setTimeout('oCouplet.doScroll()', this.delay);
} else {
window.clearTimeout(oTime);
}
} else {
if ((_oTop - _nTop) > 0) {
_left.style.top = _right.style.top = _oTop - 1 + 'px';
var oTime = window.setTimeout('oCouplet.doScroll()', this.delay);
} else {
window.clearTimeout(oTime);
}
}
}
}
window.onload = function() {
var oTop = 50, oWidth = 120, oHeight = 250, oOffset = 20;
var oDelay = 80, oAmount = 1;
oCouplet = new Couplet(oTop, oWidth, oHeight, oOffset, oDelay, oAmount);
with (document.body) {
innerHTML += oCouplet.drawCouplet(self.oContent.innerHTML);
onscroll = function() {
oCouplet.doScroll();
}
}
}
</script>
<comment id="oContent">
<div align="center">
<br>对联内容
</div>
</comment>
<pre>
</pre>
- 对联效果
- 对联效果的广告
- JS对联浮动效果
- 网页两边对联广告效果
- 对联广告代码效果大全
- 对联广告代码效果大全
- 对联广告代码效果大全
- 对联广告代码效果大全
- 对联广告代码效果大全
- 对联
- 对联
- 对联
- 对联
- 对联
- 对联
- 对联广告JS代码效果大全
- 对联广告代码效果[鼠标感应]
- 页面两侧对联广告代码效果
- 简单的c#文本文件读写
- CSS样式表常用小技巧
- 动态提示的下拉框
- JAVA环境变量设置之心得
- 一女大学生用2元进著名外企(很有启发哦)
- 对联效果
- 深入浅出理解索引结构(一)
- QQ菜单效果
- javax.servlet.ServletException: ActionMappingsまたはActionFormBeansコレクションが見つかりません
- 深入浅出理解索引结构(二)
- .listView类
- C++主题——转换函数
- 表单多文件上传类 [ASP
- 30岁前男人应该完成的事