In the evening, I suddenly saw a program that I wrote when I was working on ASP to automatically generate tables based on database data.
The requirements are:
1. For empty content, it should be written as "
| ", otherwise it will be displayed abnormally in IE (IE treats the cell as not existing).
2. When the number of output data is not equal to the "length
In fact, it is also very simple. When I was doing asp, I used a more complex algorithm (MakeTable2 in the code below). Today I thought of an easier-to-understand algorithm (MakeTable1). I implemented it using js today, but The frustrating thing is that the efficiency is the same, so it is better to use the first one (easy to understand, less code).
The code is as follows:
]