注册 登录
编程论坛 WEB前端(UI)

自动消失的表格内容

xiaobudian007 发布于 2008-12-12 22:37, 1428 次点击
有这样一个简单的表格网页内容:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>文档标题</title>
</head>

<body>
<table border="2" width="350" height="200">
  <tbody align="right">
  <tr>
    <td>表格内容1</td>
    <td>表格内容2</td>
  </tr>
  
  </tbody>
</table>
</body>
</html>
我想让表格内容1在10秒钟内自动消失,而表格内容2在1分钟内自动消失,该怎么样改写它?
5 回复
#2
bygg2008-12-13 09:31
程序代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www. xmlns="http://www. http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>文档标题</title>
<script>
    var theTime=0;
    function runload()
    {
        window.setTimeout("runload()", 1000);
        theTime = theTime + 1;
        if(theTime==10)
        {
            tbTest.rows(0).cells[0].style.display="none";
        }
        else if(theTime==20)
        {
            tbTest.rows(0).cells[1].style.display="none";
        }
    }

    runload();
</script>
</head>

<body>
<table id="tbTest" border="2" width="350" height="200">
  <tbody align="right">
  <tr>
    <td>表格内容1</td>
    <td>表格内容2</td>
  </tr>
  
  </tbody>
</table>
</body>
</html>
#3
xiaobudian0072008-12-13 23:41
楼上的朋友,你好,我看了你编写的东东,的确很好,如果单元格的数量有很多(例如是1000个),并且,每个单元格的内容是在不同时间关闭的话,那你这样编写的话,就有点不现实了,还有什么好点的方法吗?
#4
kai2008-12-14 10:36
xiaobudian007,
我好像没看到过这样的网站,你举个例子给我看看。
另外,我也看不出这种效果的实际应用的意义在哪里。
#5
bygg2008-12-15 09:31
如果,的确很多
function runload()
{
    .....
}
这个方法是可以传参数的.
function runload(rowIndex, cellIndex, theTime)   
{
    .....
}
rowIndex : 需要隐藏的行的索引值
cellIndex: 需要隐藏的列的索引值
theTime  : 多长时间隐藏.......

theTime
1