本文實(shí)例講述了JavaScript控制table某列不顯示的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
1、table代碼
2、js根據(jù)權(quán)限控制
- if (uname === "guest") {
- $("#mytable tr").each(function() {
- $(this).find("td").eq(7).css("display", "none");
- $(this).find("td").eq(8).css("display", "none");
- $(this).find("td").eq(9).css("display", "none");
- $(this).find("td").eq(10).css("display", "none");
- $(this).find("td").eq(11).css("display", "none");
- $(this).find("td").eq(12).css("display", "none");
- $(this).find("td").eq(13).css("display", "none");
- });
- }
注:如果數(shù)據(jù)是動(dòng)態(tài)數(shù)據(jù),當(dāng)賦值完后再控制顯示td,否則會(huì)造成td頭控制成功,其他行失敗的情況
新聞熱點(diǎn)
疑難解答
圖片精選