zoukankan      html  css  js  c++  java
  • 夺命雷公狗jquery---3普通选择器

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <title></title>
            <script src="js/jquery.js"></script>
            <script>
                window.onload = function(){
                    document.getElementById('btnok').onclick = function(){
                        //1.匹配第一个单元格
                        //$('td:first').html('test');
                        //2.匹配最后一个单元格
                        //$('td:last').html('test');
                        //3.通过odd和even实现隔行变色
                        //$('td:odd').css('backgroundColor','red');
                        //4.匹配索引为5的单元格
                        //$('td:eq(5)').css('backgroundColor','red');
                        //5匹配索引大于5的所有单元格
                        //$('td:gt(5)').css('backgroundColor','red');
                        //6.匹配索引小于5的所有单元格
                        //$('td:lt(5)').css('backgroundColor','red');
                        //7.匹配除索引5以外的所有td元素
                        $('td:not(td:eq(5))').css('backgroundColor','red');
                    }
                }
            </script>
        </head>
        <body>
            <input type="button" id="btnok" value="匹配" />
            <br/>
            <table width="800" border="1">
                <tr>
                    <td>0</td>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td>4</td>
                    <td>5</td>
                    <td>6</td>
                    <td>7</td>
                    <td>8</td>
                    <td>9</td>
                </tr>
            </table>
        </body>
    </html>
  • 相关阅读:
    JavaScript 的 Promise
    MacOS copy图标shell脚本
    ExtJS 修改load paging时的参数
    JSONP
    8种跨域解决方案
    Ext Store Proxy Ajax
    ExtJS 自定义组件
    MacOS Apache配置
    xshell 上传 下载文件
    shell 内网主机存活探测器
  • 原文地址:https://www.cnblogs.com/leigood/p/4890517.html
Copyright © 2011-2022 走看看