zoukankan      html  css  js  c++  java
  • 列表中被点击的行加亮背景色

    <!doctype html>
    <html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>列表中被点击的行加高亮背景色</title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />        
        <script type="text/javascript" src="../jquery-1.8.2.js"></script>
        <script type="text/javascript">
        //点击某行后,高亮点中行的样式
        function heightBrightTR(thisObj){        
           var thisTD = $(thisObj).parent();    //<a> 链接所在上层单元格td对象
            var thisTR = thisTD.parent();        //<a> 链接所在上层行tr对象    
            thisTR.addClass('trBgStyle');                    //添加背景高亮色
            thisTR.siblings('tr').removeClass('trBgStyle'); //将同级同胞的背景色置空
        }
        </script>
        <style type="text/css">
         .trBgStyle{background:#ffff66;}   /* 用于点击后改变行背景色 */
        </style>
    </head>
    <body>
        <table border="1" width="100%" cellspacing="0" cellpadding="0">
            <tr>
                <th>id号</th>
                <th>链接地址</th>
            </tr>
            <tr>
                <td>2</td>
                <td><a onclick="heightBrightTR(this)" target="_blank" href="http://www.google.com.hk">Google</a></td>
            </tr>
            <tr>
                <td>1</td>
                <td><a onclick="heightBrightTR(this)" target="_blank" href="http://www.baidu.com">百度</a></td>
            </tr> 
            <tr>
                <td>4</td>
                <td><a onclick="heightBrightTR(this)" target="_blank" href="http://cn.msn.com">MSN中文网</a></td>
            </tr>       
        </table>
    
    
    
    
    </body>
    </html>
  • 相关阅读:
    t体育课了
    Scrapy、Scrapy-redis组件
    爬虫案例(js动态生成数据)
    UA池和代理池
    增量式爬虫(简易)
    基于scrapy-redis分布式爬虫(简易)
    全栈爬取-Scrapy框架(CrawlSpider)
    scrapy中selenium的应用
    scrapy框架的日志等级和请求传参
    scrapy框架之递归解析和post请求
  • 原文地址:https://www.cnblogs.com/martinzhang/p/3302163.html
Copyright © 2011-2022 走看看