Home  >  Article  >  Web Front-end  >  JavaScript method to control a certain column of table not to be displayed_javascript skills

JavaScript method to control a certain column of table not to be displayed_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:09:131465browse

The example in this article describes how to use JavaScript to control a certain column of a table not to be displayed. Share it with everyone for your reference. The specific implementation method is as follows:

1. table code

Copy code The code is as follows:
142372d5d94a345d53734ee78faac2ab
a299c91ee875da8109e895be68e329ec
16ef4d53f751a90f0f79bd2102406772
                 fe5602380d379978c165c9c69bb0972aDateb90dd5946f0946207856a8a37f441edf
                  fe5602380d379978c165c9c69bb0972aMedia nameb90dd5946f0946207856a8a37f441edf
                   1bf5df3baaba1d206e08ccff872c6f1dDistribution formb90dd5946f0946207856a8a37f441edf
                  fe5602380d379978c165c9c69bb0972aNumber of exposuresb90dd5946f0946207856a8a37f441edf
                fe5602380d379978c165c9c69bb0972aNumber of people exposedb90dd5946f0946207856a8a37f441edf
                   fe5602380d379978c165c9c69bb0972aNumber of clicksb90dd5946f0946207856a8a37f441edf
                 fe5602380d379978c165c9c69bb0972aNumber of clicksb90dd5946f0946207856a8a37f441edf
                  fe5602380d379978c165c9c69bb0972aCTRb90dd5946f0946207856a8a37f441edf
                 fe5602380d379978c165c9c69bb0972aVisitsb90dd5946f0946207856a8a37f441edf
                 fe5602380d379978c165c9c69bb0972aNumber of bouncesb90dd5946f0946207856a8a37f441edf
                  fe5602380d379978c165c9c69bb0972aAccess depthb90dd5946f0946207856a8a37f441edf
                 fe5602380d379978c165c9c69bb0972aView time/secondb90dd5946f0946207856a8a37f441edf
                  fe5602380d379978c165c9c69bb0972aNumber of participantsb90dd5946f0946207856a8a37f441edf
                fe5602380d379978c165c9c69bb0972aNumber of people handling businessb90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
ca745a59da05f784b8811374296574e1
e1902e99e1cb8e0c7b2f1befab9216aeca745a59da05f784b8811374296574e1
f16b1740fad44fb09bfe928bcc527e08

2. js control based on permissions

Note: If the data is dynamic data, control the display of td after the assignment is completed, otherwise it will cause the td header control to succeed and other lines to fail

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");
 });
}

I hope this article will be helpful to everyone’s JavaScript programming design.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn