Hi All,
I have a table whole rows and it's values are obtained from DB...
Now I should be able to select a row from table which I am unable to achieve...
This is how the code looks like...
Code:<table id="Load" align="center" border="1" width="450" class="tablebord" bgcolor="AliceBlue" style="border-top: thin solid #CC9900;border-left: thin solid #CC9900;border-bottom: thin solid #CC9900; border-right: thin solid #CC9900"> <h2 align="center">LoadProject</h2> <tr bgcolor="grey"> <th></th> <th>ProjectName</th> <th>ProjectDescription</th> <th>ProjectCreator</th> <th>ProjectDate</th> </tr> <% System.out.println("Its in projectAction JSP !!! "); int i=0; ProjectAction projectAction=new ProjectAction(); int a=projectAction.getRowCount(); System.out.println("a is :-->"+a); // System.out.println("1st is :--> "+projectAction.getProjectNamesList().get(i)); System.out.println("2nd is :--> "+projectAction.getProjectNamesList().get(i+1)); for(int j=0; j<a;){ %> <tr id="<%= j+1%>" onclick="ChangeColor('<%= j+1%>',true)"> <td> </td> <td><%= projectAction.getProjectNamesList().get(j) %></td> <td><%= projectAction.getProjectDescriptorList().get(j)%></td> <td><%= projectAction.getProjectCreatorList().get(j)%></td> <td><%= projectAction.getProjectDateList().get(j)%></td> </tr> <% j++; } %> </table>
The values are getting displayed in the UI and on any row click I should highlight that row ...
For that I have a ChangeColor function as...
Code:function ChangeColor(tableRow, highLight) { alert(" ---> in ChangeColor function -- "); alert(tableRow); if (highLight) { alert("its highlight"); // document.getElementById('lod').getElementsByTagNa tableRow.style.backgroundColor = '#dcfac9'; } else { alert("in else,no liting !!!"); tableRow.style.backgroundColor = 'white'; } }
What should be the way to achieve it?



Reply With Quote

Bookmarks