Table选中一行Table选中一行
方法一:
html head meta http-equiv= Content-Type content= text/html; charset=gb2312 style .EvenOrOddRow{ background-color:
expression((this.sectionRowIndex%2)?'white':'#E0E0E0'); } /style
script
var currentActiveRow;
function changeActiveRow(obj) {
if(c...
Table选中一行
方法一:
html head meta http-equiv= Content-Type content= text/html; charset=gb2312 style .EvenOrOddRow{ background-color:
expression((this.sectionRowIndex%2)?'white':'#E0E0E0'); } /style
script
var currentActiveRow;
function changeActiveRow(obj) {
if(currentActiveRow)
currentActiveRow.style.backgroundColor= ;
currentActiveRow=obj;
currentActiveRow.style.backgroundColor= Red ; }
/script
/head body
table width=100%
tr bgcolor=aaaaaa td Code /td td Name /td /tr
tr class= EvenOrOddRow onclick= changeActiveRow(this); td 001 /td td zhangsan /td /tr tr class= EvenOrOddRow onclick= changeActiveRow(this); td
001 /td td zhangsan /td /tr tr class= EvenOrOddRow onclick=
changeActiveRow(this); td 001 /td td zhangsan /td /tr tr class=
EvenOrOddRow onclick= changeActiveRow(this); td 001 /td td zhangsan /td /tr
/body
方法二:
var curRow; //全局行号
var curRowId; //选中行的记录信息的ID
var curColor;
function selectRow(tr1){
if(curRow) {
curRow.bgColor=curColor;
curColor=tr1.bgColor;
tr1.bgColor= #FFE9B3 ;
}else{
curColor=tr1.bgColor;
tr1.bgColor= #FFE9B3 ; }
curRow=tr1; curRowId=tr1.id;
}
调用方法: tr onclick= selectRow(this) ...
table中鼠标移到一条记录上,然后就会自动显示有关这条记录的信息,鼠标移走之后,显示就消失:
其实很简单:用title 属性就可以
tr title= 11111 onclick= selectRow(this);
td 001 /td td zhangsan /td
/tr
本文档为【Table选中一行】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。