通行证: 用户 密码 域名空间  下载中心 社区论坛 信息公告 my小屋
联系我们
设为首页
加入收藏

 

qq,asp,php,jsp,xml,sql,.net,编程 程序 网页图象 建站经验 私服
首页 | 新闻资讯 | 编程开发 | 网页设计 | 图形图象 | 网络媒体 | 网站模板 | 数 据 库 | 投稿
论坛 | 操作系统 | 系统优化 | 网络安全 | 黑客技术 | 硬件学堂 | 硬件报价 | 服 务 器 | 地图
专题 | 应用软件 | 聊天通讯 | q q 专栏 | 建站经验 | 在线工具 | 站长club | 注 册 表 | 旧版
社会 | 游戏娱乐 | 设计欣赏 | 疑难解答 | 社区论坛 | 网络赚钱 | 网站地图 | 广告服务 | 服务
当前位置:首页>>网页设计>>网页特效>>正文 新版上线![旧版]
注:打开慢时请稍等
锁定行头和列头的表格组件

http://www.iyit.net  日期:2006-5-5 9:59:05  来源:小雨在线  点击:
参加讨论

1、在页面中引入风格单定义
<style>
.lockheadtable {behavior:url(lockheadtable.htc)}
</style>


2、在需要锁定行列头的表格定义中添加语句“class="lockheadtable"”就ok了,其他参数有
rowheadnum="锁定行数"
colheadnum="锁定列数"
rowheadstyle="行表头风格"
colheadstyle="列表头风格"
rowstyle="行风格1|行风格2|……|行风格n"
focusstyle="获得鼠标焦点时的风格"

3、点击行标题时可以对数据进行排序

注意:
  使用本组件时,行表头中的单元格不允许跨行

例:
<table class="lockheadtable" rowheadnum=3 colheadnum=1 rowheadstyle="background:#f7f7f7; color:black;" colheadstyle="background:#f7f7f7; color:black;" rowstyle="background:#ffffff; color:black;|background:#f7f7f7; color:black;"  focusstyle="background:green; color:white;" width="1500" border="1" cellpadding="3" cellspacing="0" align="center">

源代码:

lockheadtable.htc(组件程序)


<public:component>
 
 <public:property name="rowheadnum" />
 <public:property name="colheadnum" />
 <public:property name="rowheadstyle" />
 <public:property name="colheadstyle" />
 <public:property name="rowstyle" />
 <public:property name="focusstyle" />
 
 <script>
 //初始化
 rowheadnum = (rowheadnum==null?0:parseint(rowheadnum, 10));
 colheadnum = (colheadnum==null?0:parseint(colheadnum, 10));
 rowheadstyle = (rowheadstyle==null?"":rowheadstyle);
 colheadstyle = (colheadstyle==null?"":colheadstyle);
 
 arrrowstyle = (rowstyle==null?new array(""):rowstyle.split("|"));

 //设置行表头
 var i, j, rowitem, cellitem;
 rowhead = element.clonenode(true);
 for (i=0; i<rowheadnum; i++) {
  rowitem = element.rows(i);
  rowitem.style.csstext = 'z-index:10; position:relative; top:expression(this.offsetparent.scrolltop);' + rowheadstyle;
 }
 
 //设置列表头
 for (i=0; i<element.rows.length; i++) {
  rowitem = element.rows(i);
  if (i>=rowheadnum) {
   rowitem.style.csstext = "position:relative;" + arrrowstyle[(i - rowheadnum) % arrrowstyle.length];
   if (focusstyle!=null) {
    rowitem.onmouseover = function () { this.style.csstext = "position:relative;" + focusstyle;}
    rowitem.onmouseout = function () { this.style.csstext = "position:relative;" + arrrowstyle[(this.rowindex - rowheadnum) % arrrowstyle.length];}
   }
  }
   
  for (j=0; j<colheadnum; j+=cellitem.colspan) {
   cellitem = rowitem.cells(j);
   cellitem.style.csstext = 'position:relative; left:expression(this.parentelement.offsetparent.scrollleft);'
    + (i<rowheadnum?'':colheadstyle);
  }
 }
 
 //设置行标题排序
 for (i=0; i<rowheadnum; i++) {
  rowitem = element.rows(i);
  for (j=0; j<rowitem.cells.length; j++) {
   cellitem = rowitem.cells(j);
   if (cellitem.rowspan==rowheadnum-i) {
    cellitem.style.cursor = "hand";
    cellitem.sortasc = true;
    cellitem.onclick = sorttable;
   }
  }
 }

 //排序
 function sorttable() {
  var objcol = event.srcelement;
  if (objcol.tagname == "td") {
   var intcol = objcol.cellindex;
   objcol.sortasc = !objcol.sortasc;
  
   sort_type = 'num';
   if (isnan(parseint(element.rows(rowheadnum).cells(intcol).innertext, 10)))
    sort_type = 'asc';
  
   var i,j,boltmp;
   for (i = rowheadnum; i < element.rows.length; i++)
    for (j = i + 1; j < element.rows.length; j++) {
     switch (sort_type) {
     case 'num':
      boltmp = (parseint(element.rows(i).cells(intcol).innertext, 10) >= parseint(element.rows(j).cells(intcol).innertext, 10));
      break;
     case 'asc':
     default:
      boltmp = (element.rows(i).cells(intcol).innertext >= element.rows(j).cells(intcol).innertext);
     }
     if ((objcol.sortasc && !boltmp) || (!objcol.sortasc && boltmp)) {
      element.moverow(j, i);
     }
    }
  }
 }
 </script>
</public:component>



编辑:黑鹰 [发送给好友] [打印本页] [关闭窗口] [返回顶部]
上一篇:自适应图片大小的弹出窗口
下一篇:简化的enter转化成tab组件
转载请注明来源:www.iyit.net
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。

 相关文章
最新更新 热点排行 推荐新闻
javascript实例教程(3-2)
javascript实例教程(3-1)
javascript实例教程(2) 创建弹出式窗
javascript实例教程(1) 目录
荧光文字
javascript实例教程(3-2)
javascript实例教程(3-1)
javascript实例教程(2) 创建弹出式窗
javascript实例教程(1) 目录
荧光文字
鼠标周围的文字宣传
随鼠标的闪烁小星星
鼠标右键显隐效果
状态栏特效
自动关闭弹出式窗口
javascript实例教程(3-2)
javascript实例教程(3-1)
javascript实例教程(2) 创建弹出式窗
javascript实例教程(1) 目录
荧光文字
qq珊瑚虫外挂4.0版本发布!
多个广告位招商!
摄影后期系列一:1分钟为数码相片去红眼
qq挂机说明
asp进度条
photoshop通道抠图:给秀发飞扬的mm照
教您显示器亮度对比度的调节
新版上线,今日正式开通!!!
更多精彩图文广告等着您!
asp中使用sql语句教程
第二十章 开发delphi对象式数据管理功
sql简明教程(1)
vbscript和javascript互相调用 
jsp教程(四)-jsp actions的使用
操作系统被入侵后的修复过程
五一别忘电脑防毒 养成良好上网习惯
google对ie浏览器将捆绑搜索功能表担忧
新版上线,今日正式开通!!!
用photoshop创意图形“岁月”
摄影后期系列一:1分钟为数码相片去红眼

 友情链接
设置首 页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接
copyrights © 2004-2006 iyit.net all rights reserved.
网站合作、广告联系qq:147007642、466949678
易特网络技术 点击这里给我发消息