请问文字向上滚动的代码怎么写?是滚动一下停一下然后换下一行那种。
3个回答
展开全部
<div id="mq" style="width:100%;height:180px;overflow:hidden;border:0px solid" onmouseover="iScrollAmount=0" onmouseout="iScrollAmount=1">
<table class="weather">
<tr>
<th>内容</th>
<td class="tc c333" title="“>内容</td>
</tr>
<tr>
<th>内容</th>
<td class="tc c333" title="“>内容</td>
</tr>
</table>
</div>
<script type="text/javascript">
var oMarquee = document.getElementById("mq"); //滚动对象
var iLineHeight = 25; //单行高度,像素
var iLineCount = $ForcastWeatherListFirst.Count; //实际行数
var iScrollAmount = 1; //每次滚动高度,像素
function run() {
oMarquee.scrollTop += iScrollAmount;
if (oMarquee.scrollTop == iLineCount * iLineHeight)
oMarquee.scrollTop = 0;
if (oMarquee.scrollTop % iLineHeight == 0) {
window.setTimeout("run()", 3000);
} else {
window.setTimeout("run()", 50);
}
}
oMarquee.innerHTML += oMarquee.innerHTML;
window.setTimeout("run()", 3000);
</script>
<table class="weather">
<tr>
<th>内容</th>
<td class="tc c333" title="“>内容</td>
</tr>
<tr>
<th>内容</th>
<td class="tc c333" title="“>内容</td>
</tr>
</table>
</div>
<script type="text/javascript">
var oMarquee = document.getElementById("mq"); //滚动对象
var iLineHeight = 25; //单行高度,像素
var iLineCount = $ForcastWeatherListFirst.Count; //实际行数
var iScrollAmount = 1; //每次滚动高度,像素
function run() {
oMarquee.scrollTop += iScrollAmount;
if (oMarquee.scrollTop == iLineCount * iLineHeight)
oMarquee.scrollTop = 0;
if (oMarquee.scrollTop % iLineHeight == 0) {
window.setTimeout("run()", 3000);
} else {
window.setTimeout("run()", 50);
}
}
oMarquee.innerHTML += oMarquee.innerHTML;
window.setTimeout("run()", 3000);
</script>
2014-02-22
展开全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
.list, li {
list-style: none;
margin: 0;
padding: 0;
}
.scroll {
width: 500px;
height: 25px;
overflow: hidden;
border: 1px solid #333;
}
.scroll li {
width: 500px;
height: 25px;
line-height: 25px;
overflow: hidden;
}
.scroll li a {
font-size: 14px;
color: #333;
text-decoration: none;
}
.scroll li a:hover {
text-decoration: underline;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
</head>
<body>
<div class="scroll">
<ul class="list">
<li><a href="#" target="_blank">sdfsdfsdf </a></li>
<li><a href="#" target="_blank">rtyrt rty rtyrt r</a></li>
</ul>
</div>
<script>
function autoScroll(obj) {
$(obj).find(".list").animate({
marginTop: "-25px"
}, 500, function () {
$(this).css({ marginTop: "0px" }).find("li:first").appendTo(this);
})
}
$(function () {
setInterval('autoScroll(".scroll")', 3000)
})
</script>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
.list, li {
list-style: none;
margin: 0;
padding: 0;
}
.scroll {
width: 500px;
height: 25px;
overflow: hidden;
border: 1px solid #333;
}
.scroll li {
width: 500px;
height: 25px;
line-height: 25px;
overflow: hidden;
}
.scroll li a {
font-size: 14px;
color: #333;
text-decoration: none;
}
.scroll li a:hover {
text-decoration: underline;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
</head>
<body>
<div class="scroll">
<ul class="list">
<li><a href="#" target="_blank">sdfsdfsdf </a></li>
<li><a href="#" target="_blank">rtyrt rty rtyrt r</a></li>
</ul>
</div>
<script>
function autoScroll(obj) {
$(obj).find(".list").animate({
marginTop: "-25px"
}, 500, function () {
$(this).css({ marginTop: "0px" }).find("li:first").appendTo(this);
})
}
$(function () {
setInterval('autoScroll(".scroll")', 3000)
})
</script>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
'onmouseover="this.stop()"
onmouseout="this.start()"
这个是当你的鼠标停到滚动的文字时文字停止滚动和重新滚动..
onmouseout="this.start()"
这个是当你的鼠标停到滚动的文字时文字停止滚动和重新滚动..
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询