• jquery 隔行显示


    <html>
    <head>

    <style>
    .t{background:red;}
    .yes{background:yellow;}
    .ed{background:black;}
    </style>
    <script src="js/jquery-1.3.1.js"></script>
    <script>
    <!-- now i feel javascript is very at will and invisible -->
    $(function(){

    $("tbody>tr:odd").addClass("t");
    $("tbody>tr:even").addClass("yes");
    $("tr:contains('熊海洋')").addClass("ed");
     
    });


    </script>

    <!--<script>
     $(function () {
             $('tbody>tr').click(function () {
                if (!$(this).hasClass("ed")) {
       alert("hello");
                    $(this).addClass("ed").find(":radio").attr("checked", true);
                }
                else {
                    $(this).removeClass("ed").find(":radio").attr("checked", false);
                }
            });
          
        })
    </script>-->
    <script>
    $(function (){$('tbody>tr').click(function(){
    if($(this).hasClass("ed")){
    alert("have no class.");
    }else{
    $(this).addClass('ed').siblings().removeClass('ed').end().find(':radio').attr('checked',true);
    }
    })})

    </script>
    </head>
    <body>
    <table>
    <thead>
    <tr><th></th><th>姓名</th><th>性别</th><th>暂住地</th></tr>
    </thead>
    <tbody>
    <tr><td><input type="radio" name="radiobutton" value="radiobutton"></td><td>杨阿明</td><td>男</td><td>新乡</td></tr>
    <tr><td><input type="radio" name="radiobutton" value="radiobutton"></td> <td>王亚楠</td><td>男</td><td>卫辉</td></tr>
    <tr><td><input type="radio" name="radiobutton" value="radiobutton"></td><td>蒋远强</td><td>女</td><td>福罗里达</td></tr>
    <tr  style="color:red;"><td><input type="radio" name="radiobutton" value="radiobutton"></td><td>熊海洋</td><td>女</td><td>加利福尼亚</td></tr>
    </tbody>
    </table>
    </body>
    </html>

  • 相关阅读:
    检查点学习笔记
    数据驱动-参数化(Parameters)
    loadrunner -vuser
    loadrunner 事务、同步点和思考时间
    loadrunner报错
    java随机数的产生
    Codeforces Round #666 (Div. 2) Power Sequence、Multiples of Length 思维
    Educational Codeforces Round 94 (Rated for Div. 2) String Similarity、RPG Protagonist、Binary String Reconstruction、Zigzags 思维
    Leetcode】周赛203 查找大小为M的最新分组
    HDU 6880 Permutation Counting dp
  • 原文地址:https://www.cnblogs.com/guligei/p/9029260.html
Copyright © 2020-2023  润新知