HTML下的table滚动实现
<table><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>……</table>我想让这个table显示固定...
<table>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
……
</table>
我想让这个table显示固定的长度 比如我只要求显示height为1000 但是我的实际长度有1500 后面要设置成滚动 只存在上下滚动的。。。请问这个要怎么实现啊。
尽量详细点说啊 。。。不懂的。。 展开
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
……
</table>
我想让这个table显示固定的长度 比如我只要求显示height为1000 但是我的实际长度有1500 后面要设置成滚动 只存在上下滚动的。。。请问这个要怎么实现啊。
尽量详细点说啊 。。。不懂的。。 展开
4个回答
展开全部
<div style="width:600px; height:700px; overflow:scroll; overflow-x:hidden;">
这里放你的table代码
</div>
其原理是控制宽度在600像素,高度在700像素,显示滚动条并隐藏横向滚动条
这里放你的table代码
</div>
其原理是控制宽度在600像素,高度在700像素,显示滚动条并隐藏横向滚动条
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把代码保存为html格式, 上传到网页空间看看是不是你想要的!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset= gb2312">
<style type="text/css">
<!--
a
a:hover
td
-->
</style>
<script language=JAVAscript>
<!--
// ------ 定义全局变量
var theNewsNum;
var theAddNum;
var totalNum;
var CurrentPosion=0;
var theCurrentNews;
var theCurrentLength;
var theNewsText;
var theTargetLink;
var theCharacterTimeout;
var theNewsTimeout;
var theBrowserVersion;
var theWidgetOne;
var theWidgetTwo;
var theSpaceFiller;
var theLeadString;
var theNewsState;
function startTicker()
{
// ------ 设置初始数值
theCharacterTimeout = 50;//字符间隔时间
theNewsTimeout = 2000;//新闻间隔时间
theWidgetOne = "_";//新闻前面下标符1
theWidgetTwo = "-";//新闻前面下标符
theNewsState = 1;
//theNewsNum = document.body.children.incoming.children.NewsNum.innerText;//新闻总条数
//add by lin
theNewsNum = document.body.children.incoming.children.AllNews.children.length;//新闻总条数
theAddNum = document.body.children.incoming.children.AddNews.children.length;//补充条数
totalNum =theNewsNum+theAddNum;
theCurrentNews = 0;
theCurrentLength = 0;
theLeadString = " ";
theSpaceFiller = " ";
runTheTicker();
}
// --- 基础函数
function runTheTicker()
{
if(theNewsState == 1)
{
if(CurrentPosion<theNewsNum){
setupNextNews();
}
else{
setupAddNews();
}
CurrentPosion++;
if(CurrentPosion>=totalNum||CurrentPosion>=5) CurrentPosion=0; //最多条数不超过5条
}
if(theCurrentLength != theNewsText.length)
{
drawNews();
}
else
{
closeOutNews();
}
}
// --- 跳转下一条新闻
function setupNextNews()
{
theNewsState = 0;
theCurrentNews = theCurrentNews % theNewsNum;
theNewsText = document.body.children.incoming.children.AllNews.children[theCurrentNews].children.Summary.innerText;
theTargetLink = document.body.children.incoming.children.AllNews.children[theCurrentNews].children.NewsLink.innerText;
theCurrentLength = 0;
document.all.hottext.href = theTargetLink;
theCurrentNews++;
}
function setupAddNews()
{
theNewsState = 0;
theCurrentNews = theCurrentNews % theAddNum;
theNewsText = document.body.children.incoming.children.AddNews.children[theCurrentNews].children.Summary.innerText;
theTargetLink = document.body.children.incoming.children.AddNews.children[theCurrentNews].children.NewsLink.innerText;
theCurrentLength = 0;
document.all.hottext.href = theTargetLink;
theCurrentNews++;
}
// --- 滚动新闻
function drawNews()
{
var myWidget;
if((theCurrentLength % 2) == 1)
{
myWidget = theWidgetOne;
}
else
{
myWidget = theWidgetTwo;
}
document.all.hottext.innerHTML = theLeadString + theNewsText.substring(0,theCurrentLength) + myWidget + theSpaceFiller;
theCurrentLength++;
setTimeout("runTheTicker()", theCharacterTimeout);
}
// --- 结束新闻循环
function closeOutNews()
{
document.all.hottext.innerHTML = theLeadString + theNewsText + theSpaceFiller;
theNewsState = 1;
setTimeout("runTheTicker()", theNewsTimeout);
}
window.onload=startTicker;
//-->
</script>
</head>
<body>
<script type="text/javascript">
var vjAcc="860010-0120120000";
vjTrack();
</script>
<noscript>
<img src="" width="1" height="1" />
</noscript>
<table>
<tr><td>
<div id=visible>你的文字说明:<a href="" id=hottext target="_blank"></a></div>
</td></tr>
</table>
<div id=incoming style="DISPLAY: none">
<div id=AllNews>
如果对您有帮助,请记得采纳为满意答案,谢谢!祝您生活愉快!
vaela
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset= gb2312">
<style type="text/css">
<!--
a
a:hover
td
-->
</style>
<script language=JAVAscript>
<!--
// ------ 定义全局变量
var theNewsNum;
var theAddNum;
var totalNum;
var CurrentPosion=0;
var theCurrentNews;
var theCurrentLength;
var theNewsText;
var theTargetLink;
var theCharacterTimeout;
var theNewsTimeout;
var theBrowserVersion;
var theWidgetOne;
var theWidgetTwo;
var theSpaceFiller;
var theLeadString;
var theNewsState;
function startTicker()
{
// ------ 设置初始数值
theCharacterTimeout = 50;//字符间隔时间
theNewsTimeout = 2000;//新闻间隔时间
theWidgetOne = "_";//新闻前面下标符1
theWidgetTwo = "-";//新闻前面下标符
theNewsState = 1;
//theNewsNum = document.body.children.incoming.children.NewsNum.innerText;//新闻总条数
//add by lin
theNewsNum = document.body.children.incoming.children.AllNews.children.length;//新闻总条数
theAddNum = document.body.children.incoming.children.AddNews.children.length;//补充条数
totalNum =theNewsNum+theAddNum;
theCurrentNews = 0;
theCurrentLength = 0;
theLeadString = " ";
theSpaceFiller = " ";
runTheTicker();
}
// --- 基础函数
function runTheTicker()
{
if(theNewsState == 1)
{
if(CurrentPosion<theNewsNum){
setupNextNews();
}
else{
setupAddNews();
}
CurrentPosion++;
if(CurrentPosion>=totalNum||CurrentPosion>=5) CurrentPosion=0; //最多条数不超过5条
}
if(theCurrentLength != theNewsText.length)
{
drawNews();
}
else
{
closeOutNews();
}
}
// --- 跳转下一条新闻
function setupNextNews()
{
theNewsState = 0;
theCurrentNews = theCurrentNews % theNewsNum;
theNewsText = document.body.children.incoming.children.AllNews.children[theCurrentNews].children.Summary.innerText;
theTargetLink = document.body.children.incoming.children.AllNews.children[theCurrentNews].children.NewsLink.innerText;
theCurrentLength = 0;
document.all.hottext.href = theTargetLink;
theCurrentNews++;
}
function setupAddNews()
{
theNewsState = 0;
theCurrentNews = theCurrentNews % theAddNum;
theNewsText = document.body.children.incoming.children.AddNews.children[theCurrentNews].children.Summary.innerText;
theTargetLink = document.body.children.incoming.children.AddNews.children[theCurrentNews].children.NewsLink.innerText;
theCurrentLength = 0;
document.all.hottext.href = theTargetLink;
theCurrentNews++;
}
// --- 滚动新闻
function drawNews()
{
var myWidget;
if((theCurrentLength % 2) == 1)
{
myWidget = theWidgetOne;
}
else
{
myWidget = theWidgetTwo;
}
document.all.hottext.innerHTML = theLeadString + theNewsText.substring(0,theCurrentLength) + myWidget + theSpaceFiller;
theCurrentLength++;
setTimeout("runTheTicker()", theCharacterTimeout);
}
// --- 结束新闻循环
function closeOutNews()
{
document.all.hottext.innerHTML = theLeadString + theNewsText + theSpaceFiller;
theNewsState = 1;
setTimeout("runTheTicker()", theNewsTimeout);
}
window.onload=startTicker;
//-->
</script>
</head>
<body>
<script type="text/javascript">
var vjAcc="860010-0120120000";
vjTrack();
</script>
<noscript>
<img src="" width="1" height="1" />
</noscript>
<table>
<tr><td>
<div id=visible>你的文字说明:<a href="" id=hottext target="_blank"></a></div>
</td></tr>
</table>
<div id=incoming style="DISPLAY: none">
<div id=AllNews>
如果对您有帮助,请记得采纳为满意答案,谢谢!祝您生活愉快!
vaela
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用<marquee></marquee>标签不久行了 呵呵
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询