超碰免费人人操|国产视频二区久久艹人人操|欧美激情第一页在线|久热最新无码中文视频|91精品国际成人|亚洲成人精品在线视频青青草|久草免费高清完整在线观看|你懂的AV在线日本黄网页|国产黄色AV日韩女同网|欧美成人色区导航片av

<label id="je44b"></label>
  • 如何使用jQuery5分鐘快速搞定雙色表格

    時(shí)間:2024-09-11 13:59:11 jQuery

    如何使用jQuery5分鐘快速搞定雙色表格

      先看看這個(gè)使用jQuery做的雙色表格的效果:

      這個(gè)雙色表格看上去應(yīng)該覺得挺專業(yè)的,不過它用jQuery實(shí)現(xiàn)的確很簡單。

      第一步:寫好css。

      th { /*表頭樣式*/ background:#0066FF; color:#FFFFFF; line-height:20px; height:30px; } td { padding:6px 11px; border-bottom:1px solid #95bce2; vertical-align:top; text-align:center; } td * { padding:6px 11px; } tr.alt td { background:#ecf6fc; /*這行將給所有的tr加上背景色*/ } tr.over td { background:#bcd4ec; /*這個(gè)將是鼠標(biāo)高亮行的背景色*/ }

      第二步:寫jQuery頁面加載事件:

      $(function(){//給class為stripe的表格的偶數(shù)行添加class值為alt $(".stripe tr:even").addClass("alt"); $(".stripe tr").mouseover(function(){//如果鼠標(biāo)移到class為stripe的表格的tr上時(shí),執(zhí)行函數(shù) $(this).addClass("over");}).mouseout(function(){//給這行添加class值為over,并且當(dāng)鼠標(biāo)一出該行時(shí)執(zhí)行函數(shù) $(this).removeClass("over"); })});

      上面的鼠標(biāo)懸浮事件采用了jQuery的鏈?zhǔn)讲僮鳎緛硎菓?yīng)該這么寫的:

      $(".stripe tr").mouseover(function(){ $(this).addClass("over");}) $(".stripe tr").mouseout(function(){ $(this).removeClass("over"); })

      但上面的的代碼卻寫成了這樣:

      $(".stripe tr").mouseover(function(){ $(this).addClass("over");}).mouseout(function(){ $(this).removeClass("over");})

      在jQuery中,執(zhí)行完mouseover或mouseout等方法之后,它會返回當(dāng)前的操作對象,所以可以采用jQuery的鏈?zhǔn)讲僮鳌?/p>

      下面把完整的jsp代碼貼出來MyJsp.jsp:

      <%@ page="" language="java" import="java.util.*" pageencoding="UTF-8"><%string path="request.getContextPath();String" basepath="request.getScheme()+">

      $(function(){//給class為stripe的表格的偶數(shù)行添加class值為alt $(".stripe tr:even").addClass("alt"); $(".stripe tr").mouseover(function(){//如果鼠標(biāo)移到class為stripe的表格的tr上時(shí),執(zhí)行函數(shù) $(this).addClass("over");}).mouseout(function(){//給這行添加class值為over,并且當(dāng)鼠標(biāo)一出該行時(shí)執(zhí)行函數(shù) $(this).removeClass("over"); })});

      th { background:#0066FF; color:#FFFFFF; line-height:20px; height:30px; } td { padding:6px 11px; border-bottom:1px solid #95bce2; vertical-align:top; text-align:center; } td * { padding:6px 11px; } tr.alt td { background:#ecf6fc; /*這行將給所有的tr加上背景色*/ } tr.over td { background:#bcd4ec; /*這個(gè)將是鼠標(biāo)高亮行的背景色*/ }

    姓名年齡QQEmail
    李曉紅24859855***859855***@qq.com
    云天河18123456789123456789@qq.com
    柳夢璃18987654321987654321@qq.com
    韓菱紗18888888888888888888@qq.com
    玄霄58123456123456@qq.com
    土靈珠1000-10000-10000@qq.com

      怎么樣呢?jQuery就是這么給力。以上這篇使用jQuery5分鐘快速搞定雙色表格的簡單實(shí)例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考。

    【如何使用jQuery5分鐘快速搞定雙色表格】相關(guān)文章:

    如何用CAD快速畫表格10-04

    怎樣快速搞定上班妝08-23

    如何高效快速搞定雅思聽力?四遍法就可以07-29

    如何30分鐘內(nèi)搞定托福寫作考試07-09

    如何搞定軟裝10-24

    Word表格快速處理的方法07-01

    枸杞雙色吐司的做法10-30

    如何把EXCEL表格轉(zhuǎn)成WORD表格02-19

    如何快速增肌06-10

    如何快速學(xué)習(xí)粵語08-10