当前位置: 首页 > 图文教程 > 网络编程 > ASP > 如何固定表格的标题行和标题列

ASP
ASP字符串大写转换成小写 ASP小写转换成大写 ucase lcase
asp base64加解密函数代码
Discuz!NT 论坛整合ASP程序论坛
discuz 2.0整合asp系统,用户添加函数
P3P 和 跨域 (cross-domain) cookie 访问(读取和设置)
通过asp程序来创建access数据库
检查access数据库中是否存在某个名字的表的asp代码
asp #include file 与 #include virtual 的区别小结
一个带采集远程文章内容,保存图片,生成文件等完整的采集功能
asp 横排显示数据
asp base64 utf-8为了兼容asp.net的base64
两个非常规ASP木马(可躲过扫描)
asp DateDiff实现文字在特定时间后消失
ASP所有的Session变量获取实现代码
关于ASP eof与bof 区别分析
asp ajax注册验证之 防止用户名输入空格
asp sqlserver 执行存储过程返回记录集报对象关闭时不允许操作
ASP 获取文件扩展名函数getFileExt()
asp 简单分页代码
asp删除mssql数据库中没有记录的图片代码

ASP 中的 如何固定表格的标题行和标题列


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 72 ::
收藏到网摘: n/a

网上有许关于固定表格的标题行的文章,但是既要固定标题行又要固定标题列的却几乎没有。现我写下如下代码以供大家参考:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script>
function syncscroll(obj)
{
 y.innerHTML = obj.scrollTop;
 x.innerHTML = obj.scrollLeft;
 scroll1.children[0].style.position = "relative";
 scroll2.children[0].style.position = "relative";
 scroll1.children[0].style.left = "-"+obj.scrollLeft;
 scroll2.children[0].style.top =  "-"+obj.scrollTop;
 
}
</script>
<body>
<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
  <!--*****************************************************左上-BEGIN*****************************************************-->

  <table width="240" height="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#666666">
   <colgroup>
   <col width="80" >
   <col width="80" >
   <col width="80" >
   </colgroup>
    <tr bgcolor="#FFFFFF">
   <td height="20">&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
    </tr>
  </table>

  <!--*****************************************************左上-END*****************************************************-->
 </td>
    <td>
 <div id='scroll1' style="width:450;overflow:hidden ">
  <!--*****************************************************右上-BEGIN*****************************************************-->

  <table style="width:900 " height="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#666666">
   <colgroup>
   <col width="150" >
   <col width="150" >
   <col width="150" >
   <col width="150" >
   <col width="150" >
   </colgroup>
    <tr bgcolor="#FFFFFF">
   <td>&nbsp;</td>
   <td height="20">&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
    </tr>
  </table>

  <!--*****************************************************右上-END*****************************************************-->
 </div>
 </td>
  </tr>
  <tr>
    <td align="left" valign="top">
 <div id='scroll2' style="height:150;overflow-y:hidden;overflow-x:scroll">
  <!--*****************************************************左下-BEGIN*****************************************************-->

  <table width="240" height="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#666666">
   <colgroup>
   <col width="80" >
   <col width="80" >
   <col width="80" >
   </colgroup>

    <tr bgcolor="#FFFFFF">
   <td height="20">&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
    </tr>
    &