//光棒效果 var _bgColor; //存放原始的 背景顏色 $(document).ready(function() { //所有的行鼠標移進時變色 $("tr").hover(function () { _bgColor = $(this)[0].style.backgroundColor; $(this).css({'background-color' : '#f5f5f5', 'font-weight' : 'bolder'}); }, //移除還原顏色 function () {var cssObj = {'background-color':_bgColor,'font-weight':''} $(this).css(cssObj); }); //交替行變色 var trs = $("table").find("tr"); for(i = 0;i<trs.length;i++) { var obj = trs[i]; if(i %2 == 0) obj.style.backgroundColor = "#F5FAFE"; } });
示例圖如下:
當然 腳本可以再進行優化
{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"typ
{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragr
{"type":"doc","content":[{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"概述"}]},{"t
{"type":"doc","content":[{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"前言"}]},{"t
{"type":"doc","content":[{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"前言"}]},{"t