JSP Code:
HTML code
- <c:foreach var= "main" items= "${mainpage.list}" >
- <tr>
- <td><a class= "SCENESTR_TD" >${main.scenestr}</a></td>
- <TD class= "concern" >${main.concernednumber}</td>
- <TD class= "Noconcern" >${main.noconcernednumber}</td>
- <TD class= "ValidateNumber" >${main.validatenumber}</td>
- <td>${main.createtime}</td>
- <td>${main.delflag==0? ' Allow ': ' Do not allow '}</td>
- <td>
- <a href= "${main.url}" target= "_blank" > QR code link </a>
- </td>
- </tr>
- </c:forEach>
- <tr class= "Count_main" >
- <th style= "Text-align:center;" > Statistics:</th>
- <TD class= "Count_concern" >0</td>
- <TD class= "Count_noconcern" >0</td>
- <TD class= "Count_validatenumber" >0</td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
Copy Code
JS Code:
HTML code
- var main_list_size = $ (". Main_list_size"). Val ();//Get primary single loop size
- Main_list_size = parseint (main_list_size);
- var count_concern = parseint (0);
- var count_noconcern = parseint (0);
- var count_validatenumber = parseint (0);
- if (main_list_size<=0) {
- $ (". Count_main"). Hide ();//When there is no data, the row is hidden
- }else{
- var concern = $ (". Concern Noconcern ValidateNumber");
- for (Var i=0;i<main_list_size;i++) {
- Count_concerncount_concern = count_concern+ parseint ($ (". Concern"). EQ (i). html ());
- Count_noconcerncount_noconcern = Count_noconcern + parseint ($ (". Noconcern"). EQ (i). html ());
- Count_validatenumbercount_validatenumber = Count_validatenumber + parseint ($ (". ValidateNumber"). EQ (i). html ());
- }
- $ (". Count_concern"). HTML (Count_concern);
- $ (". Count_noconcern"). HTML (Count_noconcern);
- $ (". Count_validatenumber"). HTML (count_validatenumber);
- $ (". Count_main"). Show ();//When there is data, the line is displayed
- }
Copy Code
So, the following statistics are all out?
Original Address Java Community http://techfoxbbs.com/thread-2646-1-1.html
"JQuery: Traverse all values of the same class and traverse the value of a column TD"