本文實例講述了JavaScript控制table某列不顯示的方法。分享給大家供大家參考。具體實現方法如下:
1、table代碼
2、js根據權限控制
注:如果數據是動態數據,當賦值完后再控制顯示td,否則會造成td頭控制成功,其他行失敗的情況
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"); });}
希望本文所述對大家的javascript程序設計有所幫助。
新聞熱點
疑難解答