This article describes how to generate an SQL query form using JavaScript. It involves javascript page elements and string operations related skills and has some reference value, for more information about how to generate an SQL query form using JavaScript, see the following example. Share it with you for your reference. The details are as follows:
Here, JavaScript is used to generate a complex SQL Query Form. After you run it, you will understand that it can automatically modify your SQL statements based on the selected query conditions. This is a typical application.
The running effect is as follows:
The Code is as follows:
Query condition formScript /// constructor function ce (e) {return document. createElement (e)}/* Example: * var a = cex ("DIV", {onmouseover: foo, name: 'p1', id: 'main '}); */function cex (e, x) {var a = ce (e); for (prop in x) {a [prop] = x [prop];} return ;} /** function ge * Shorthand function for document. getElementById (I) */function ge (I) {return document. getElementById (I)}/** function ac * Example: ac (house, ac (roof, shingles), ac (floor, ac (tiles, grout ))) */function ac () {if (ac. arguments. length> 1) {var a = ac. arguments [0]; for (I = 1; I = 150) document. all. conditionBox. style. height = h-20 + "px"; else return false;} function getSQL () {var SQL = ""; var ma = ge ("ConditionBox "). childNodes; for (I = 0; I
| Complex Query Form |
| 65 |
| SQL expressions |
Define conditions
| Table |
Table 1 Table 2 Table 3 Table 4 Table 5 |
Field |
Field 1 Field 2 Field 3 Field 4 Field 5 Field 6 Field 7 |
Link |
Greater Equal Less Not equal Null Not empty Include |
Value |
|
|
|
I hope this article will help you design javascript programs.