In web pages, the layout of tables is often visible. When the number of rows in a table is very large, it can easily lead to visual fatigue, and it is easy for users to read the data of the adjacent two rows. We can improve the user experience by changing the color of the line and highlighting it! If css is used for implementation, the front-end code will be slightly less elegant. For example, in the odd line, we need to add Code such as <tr class = "odd"> to implement line-by-line color change, in addition, if the webpage is dynamically output from the background, this cannot be implemented unless it is controlled by a program. Tr: hover is not supported in ie6. So we still cannot fully meet our requirements. Here we can use javascript to help us achieve the above requirements. It is mainly used to operate the DOM.First, check the HTML code:
01 |
<h1> Member information table </h1> |
02 |
<table summary="user infomation table"> |
06 |
<th> Member name </th> |
08 |
<th> Member group </th> |
10 |
<th> Registration time </th> |