Home > Web Front-end > JS Tutorial > body text

A function that automatically generates tables based on content implemented using js_javascript skills

WBOY
Release: 2016-05-16 19:09:40
Original
1189 people have browsed it

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:


[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]
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