六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 47|回复: 0

简易向上的滚动

[复制链接]

升级  13.67%

71

主题

71

主题

71

主题

举人

Rank: 3Rank: 3

积分
241
 楼主| 发表于 2013-1-26 12:43:03 | 显示全部楼层 |阅读模式
<!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=utf-8" /><title>无标题文档</title><script type="text/javascript">function marQuee(opts){var g = function(id){return "string" == typeof id ? document.getElementById(id) : id;},c = function(tagName){return document.createElement(tagName)};var o = g(opts.id),oParent = g(opts.pid),pH = oParent.offsetHeight,oH = o.offsetHeight,tempNum = pH % oH == 0 ? pH/oH : parseInt(pH/oH)+1,time = opts.time || 30,wT,oTemp = c("div");oTemp.id = "oTemp";for(var i = 0; i < tempNum; i++){oTemp.innerHTML += o.innerHTML;}oParent.appendChild(oTemp);function mq(){wT = window.setInterval(function(){if(oTemp.offsetTop - oParent.scrollTop <= 0){oParent.scrollTop -= o.offsetHeight;}else{oParent.scrollTop++;}},time);}mq();oParent.onmouseover = function(){window.clearInterval(wT);};oParent.onmouseout = function(){mq()};}window.onload = function(){marQuee({id : "test",pid : "outter",time : 30})}</script></head><body ><div style="height:200px;overflow:hidden;background:#999999;width:400px;border:1px solid black" id="outter"><div id="test">1111111<br/>222222222<br/>33333333333<br/>44444444444<br/>55555555555<br/><img src='http://www.baidu.com/img/baidu_sylogo1.gif'/></div></div></body></html>
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表