Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 16:09:13
Original
1487 people have browsed it

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:
cellpadding="3" cellspacing="1" bgcolor="#dfdfdf">


                
                 
                  
                 
               
                  
                
                 
                
                
                 
                
                 
               



DateMedia nameDistribution formNumber of exposuresNumber of people exposedNumber of clicksNumber of clicksCTRVisitsNumber of bouncesAccess depthView time/secondNumber of participantsNumber of people handling business

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

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template