您的位置:首页 > Web前端 > JQuery

jquery设置table中td隐藏显示 俗称动态列

2013-03-28 00:00 806 查看
function checkMyCase(){
var s = document.getElementsByName("case");
var s2 = "";
var b1,b2,b3;
for( var i = 0; i < s.length; i++ )
{
if (s[i].checked ){
if(s[i].value=="1"){
b1=true;
}
if(s[i].value=="2"){
b2=true;
}
if(s[i].value=="3"){
b3=true;
}
}
}
$("#mytable tr").find('td:eq(1)').hide();
$("#mytable tr").find('td:eq(2)').hide();
$("#mytable tr").find('td:eq(3)').hide();
if(b1==true){
$("#mytable tr").find('td:eq(1)').show();
}
if(b2==true){
$("#mytable tr").find('td:eq(2)').show();
}
if(b3==true){
$("#mytable tr").find('td:eq(3)').show();
}
}

相信基础的checkbox,我未定义大家都看的懂把。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息