即点即现的实现

<script type="text/javascript"
src="http://www.cssrain.cn/demo/jquery.js"></script>
<script type="text/javascript">
var i=2;
$(document).ready(function(){
$("#total").css("cursor","pointer")
.click(function(){
if(i%2==0){
$("#total_student").css("display","");
$("#total_staff").css("display","");

$("#tea").css("display","none");
$("#stu").css("display","none");
$("#oth").css("display","none");
$("#ads").css("display","none");

$("#lst").css("display","none");
$("#hst").css("display","none");

i++;
}else{
   $("#total_student").css("display","none");
$("#total_staff").css("display","none");

$("#tea").css("display","none");
$("#stu").css("display","none");
$("#oth").css("display","none");
$("#ads").css("display","none");

$("#lst").css("display","none");
$("#hst").css("display","none");
i++;
}

});
});


var j=2;
$(document).ready(function(){
$("#total_student").css("cursor","pointer")
.click(function(){
if(j%2==0){
$("#tea").css("display","");
$("#stu").css("display","");
$("#oth").css("display","");
$("#ads").css("display","");
j++;
}else{
   $("#tea").css("display","none");
$("#stu").css("display","none");
$("#oth").css("display","none");
$("#ads").css("display","none");
j++;
}

});
});

var m=2;
$(document).ready(function(){
$("#total_staff").css("cursor","pointer")
.click(function(){
if(m%2==0){
$("#lst").css("display","");
$("#hst").css("display","");
m++;
}else{
$("#lst").css("display","none");
$("#hst").css("display","none");
m++;
}

});
});
</script>

 


<table width="100%" cellspacing="2" style="margin-top: 15px;">
<tr align="left">
   <th colspan="2">
    数据统计信息
   </th>
</tr>
<tr align="left">
   <th width="400px">
    <u id="total"> 总激活人数</u>
   </th>
   <td>
    1000人
   </td>
</tr>
<tr align="center" id="total_student" style="display: none">
   <th>
    学生激活人数
   </th>
   <td>
    50人
   </td>
</tr>

<tr align="right" id="tea" style="display: none">
   <th>

    在校本科生激活人数
   </th>
   <td>
    20人
   </td>
</tr>
<tr align="right" id="stu" style="display: none">
   <th>

    在校硕士生激活人数
   </th>
   <td>
    100人
   </td>
</tr>
<tr align="right" id="oth" style="display: none">
   <th>

    在校博士生激活人数
   </th>
   <td>
    200人
   </td>
</tr>
<tr align="right" id="ads" style="display: none">
   <th>

    在校留学生激活人数
   </th>
   <td>
    300人
   </td>
</tr>

<tr align="center" id="total_staff" style="display: none">
   <th>
    教职工激活人数
   </th>
   <td>
    200人
   </td>
</tr>

<tr align="right" id="lst" style="display: none">
   <th>

    在校教职工激活人数
   </th>
   <td>
    100人
   </td>
</tr>
<tr align="right" id="hst" style="display: none">
   <th>

    附属医院教职工激活人数
   </th>
   <td>
    100人
   </td>
</tr>

</table>

 

 

将上诉代码保存为html文件,用浏览器打开可看到效果。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值