1<!--
2功能:JavaScript实现自定义SQL语句生成
3作者:郭拉
42007-2-7
5e-mail:guo_la@163.com
6-->
7<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8<html>
9 <head>
10 <title>代理商收入明细表</title>
11 <meta http-equiv="pragma" content="no-cache">
12 <meta http-equiv="cache-control" content="no-cache">
13 <meta http-equiv="expires" content="0">
14 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
15 <meta http-equiv="description" content="This is my page">
16 <link rel="stylesheet" type="text/css" href="cnc.css">
17 </head>
18 <body onLoad=javascript:addRow()>
19 <P>
20 <SCRIPT>
21 function addRow()
22 {
23 myNewRow = document.all.myTable.insertRow();
24 var lenRow = document.all.myTable.rows.length;
25
26 if(lenRow > 1)
27 {
28 var point = myNewRow.rowIndex;
29 var lenCol = document.all.myTable.rows(0).cells.length;
30 var sa="sa"+lenRow;
31 var sb="sb"+lenRow;
32 var sc="sc"+lenRow;
33 var sd="sd"+lenRow;
34
35 for (i=0; i < lenCol; i++)
36 {
37 if(i == 0){
38 document.all.myTable.rows(point).insertCell();
39 ////document.all.myTable.rows(point).cells(i).innerHTML= "<div align=center><select name='select'><option value=''></><option value='name'>名称 </><option value='sex'>性别</><option value='add'>地址</></select></div>";
40 document.all.myTable.rows(point).cells(i).innerHTML= "<div align=center><select name='select' id="+sa+"><option value='地区名称'>地区名称 </><option value='客户名称'>客户名称 </><option value='客户证件类型'>客户证件类型 </><option value='客户证件号'>客户证件号 </><option value='客户三类标志'>客户三类标志 </></select></div>";
41 }
42 else if (i == 1) {
43 document.all.myTable.rows(point).insertCell();
44 document.all.myTable.rows(point).cells(i).innerHTML = "<div align=center><select name='select' id="+sb+"><option value='>'>></><option value='<'><</><option value='='>=</><option value='like'>包含</></select></div>";
45 }
46 else if (i == 2) {
47 document.all.myTable.rows(point).insertCell();
48 document.all.myTable.rows(point).cells(i).innerHTML = "<div align=center><input type='text' name='value' id="+sc+" class=bt2></div>";
49 }
50 else if (i == 3) {
51 document.all.myTable.rows(point).insertCell();
52 document.all.myTable.rows(point).cells(i).innerHTML = "<div align=center><select name='lj' id="+sd+" onChange='javascript: addRow()'><option ></><option value='and'>并且</><option value='or'>或者</></select></div>";
53 }
54 }
55 }
56 if(lenRow == 1)
57 {
58 for(i = 0; i < 4; i++)
59 {
60 document.all.myTable.rows(0).insertCell();
61 document.all.myTable.rows(0).cells(i).innerHTML = " ";
62 }
63 }
64 }
65 function delRow()
66 {
67 var lenRow1 = document.all.myTable.rows.length;
68 if (lenRow1 > 2) {
69 document.all.myTable.deleteRow();
70 }
71 }
72 </SCRIPT>
73 <SCRIPT>
74 function lookdate()
75 {
76 var Rows=document.all.myTable.rows.length;
77 var sa="sa";
78 var sb="sb";
79 var sc="sc";
80 var sd="sd";
81 var s="";
82
83 for(x=2;x<=Rows;x++)
84 {
85
86 for(i=0;i<document.all.item(sa+x).length;i++)
87 {
88 if(document.all.item(sa+x).options[i].selected)
89 {
90 s=s+ document.all.item(sa+x).options[i].value+" ";
91 //alert(s);
92 break;
93 }
94 }
95
96 for(i=0;i<document.all.item(sb+x).length;i++)
97 {
98 if(document.all.item(sb+x).options[i].selected)
99 {
100 s=s+document.all.item(sb+x).options[i].value+" ";
101 //alert(s);
102 break;
103 }
104 }
105
106 ///s=s+"'"+document.all.item(sc+x).value +"' ";
107 s=s+document.all.item(sc+x).value ;
108 for(i=0;i<document.all.item(sd+x).length;i++)
109 {
110 if(document.all.item(sd+x).options[i].selected)
111 {
112 s=s+document.all.item(sd+x).options[i].value +" ";
113 //alert(s);
114 break;
115 }
116 }
117
118
119 // alert(s);
120 }
121 alert(s);
122 document.forms[0].elements[3].value=s;
123 //document.forms[0].submit(); 这行为点击自动提交。
124
125 }
126 </SCRIPT></P><P>
127 <BR/>
128 <br/>
129 <center>
130 请在下面选择查询条件
131 </center> </P>
132 <table width="90%" border=1 align="center" cellpadding="0" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF" id=myTable name=myTable>
133 <tr bgcolor="#DBDBDB">
134 <td><div align="center">字段名</div></td>
135 <td><div align="center">比较符</div></td>
136 <td><div align="center">查询值</div></td>
137 <td><div align="center">关连符</div></td>
138 </tr>
139 </table>
140 <p align ="center"><a href="javascript:delRow()">删除条件</a>
141 <a href="javascript:lookdate()">查询</a></p>
142 <FORM action="display.jsp" method="get" name="sql" >
143 <table width="100%" border="1">
144 <tr>
145 <td width="85%">
146 <INPUT type="hidden" name="sqltext" value="">
147 SELECT
148 <INPUT name="sqltext1" type="text" value=" *" size="32">
149 From
150 <INPUT name="tablename" type="text" id="sqltext2" size="16" value="all200612">
151 Where
152 <INPUT name="sqltext3" type="text" id="sqltext3" value=" rownum<100" size="32">
153 <INPUT type="Submit" name="button1" value="提交" />
154 </td>
155
156 </tr>
157 </table>
158 </FORM>
159 <p>
160 <center>
161 选择完成后请点击查询
162 </center>
163 </p>
164
165
166
167 </body>
168</html>
169
170
171
2功能:JavaScript实现自定义SQL语句生成
3作者:郭拉
42007-2-7
5e-mail:guo_la@163.com
6-->
7<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8<html>
9 <head>
10 <title>代理商收入明细表</title>
11 <meta http-equiv="pragma" content="no-cache">
12 <meta http-equiv="cache-control" content="no-cache">
13 <meta http-equiv="expires" content="0">
14 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
15 <meta http-equiv="description" content="This is my page">
16 <link rel="stylesheet" type="text/css" href="cnc.css">
17 </head>
18 <body onLoad=javascript:addRow()>
19 <P>
20 <SCRIPT>
21 function addRow()
22 {
23 myNewRow = document.all.myTable.insertRow();
24 var lenRow = document.all.myTable.rows.length;
25
26 if(lenRow > 1)
27 {
28 var point = myNewRow.rowIndex;
29 var lenCol = document.all.myTable.rows(0).cells.length;
30 var sa="sa"+lenRow;
31 var sb="sb"+lenRow;
32 var sc="sc"+lenRow;
33 var sd="sd"+lenRow;
34
35 for (i=0; i < lenCol; i++)
36 {
37 if(i == 0){
38 document.all.myTable.rows(point).insertCell();
39 ////document.all.myTable.rows(point).cells(i).innerHTML= "<div align=center><select name='select'><option value=''></><option value='name'>名称 </><option value='sex'>性别</><option value='add'>地址</></select></div>";
40 document.all.myTable.rows(point).cells(i).innerHTML= "<div align=center><select name='select' id="+sa+"><option value='地区名称'>地区名称 </><option value='客户名称'>客户名称 </><option value='客户证件类型'>客户证件类型 </><option value='客户证件号'>客户证件号 </><option value='客户三类标志'>客户三类标志 </></select></div>";
41 }
42 else if (i == 1) {
43 document.all.myTable.rows(point).insertCell();
44 document.all.myTable.rows(point).cells(i).innerHTML = "<div align=center><select name='select' id="+sb+"><option value='>'>></><option value='<'><</><option value='='>=</><option value='like'>包含</></select></div>";
45 }
46 else if (i == 2) {
47 document.all.myTable.rows(point).insertCell();
48 document.all.myTable.rows(point).cells(i).innerHTML = "<div align=center><input type='text' name='value' id="+sc+" class=bt2></div>";
49 }
50 else if (i == 3) {
51 document.all.myTable.rows(point).insertCell();
52 document.all.myTable.rows(point).cells(i).innerHTML = "<div align=center><select name='lj' id="+sd+" onChange='javascript: addRow()'><option ></><option value='and'>并且</><option value='or'>或者</></select></div>";
53 }
54 }
55 }
56 if(lenRow == 1)
57 {
58 for(i = 0; i < 4; i++)
59 {
60 document.all.myTable.rows(0).insertCell();
61 document.all.myTable.rows(0).cells(i).innerHTML = " ";
62 }
63 }
64 }
65 function delRow()
66 {
67 var lenRow1 = document.all.myTable.rows.length;
68 if (lenRow1 > 2) {
69 document.all.myTable.deleteRow();
70 }
71 }
72 </SCRIPT>
73 <SCRIPT>
74 function lookdate()
75 {
76 var Rows=document.all.myTable.rows.length;
77 var sa="sa";
78 var sb="sb";
79 var sc="sc";
80 var sd="sd";
81 var s="";
82
83 for(x=2;x<=Rows;x++)
84 {
85
86 for(i=0;i<document.all.item(sa+x).length;i++)
87 {
88 if(document.all.item(sa+x).options[i].selected)
89 {
90 s=s+ document.all.item(sa+x).options[i].value+" ";
91 //alert(s);
92 break;
93 }
94 }
95
96 for(i=0;i<document.all.item(sb+x).length;i++)
97 {
98 if(document.all.item(sb+x).options[i].selected)
99 {
100 s=s+document.all.item(sb+x).options[i].value+" ";
101 //alert(s);
102 break;
103 }
104 }
105
106 ///s=s+"'"+document.all.item(sc+x).value +"' ";
107 s=s+document.all.item(sc+x).value ;
108 for(i=0;i<document.all.item(sd+x).length;i++)
109 {
110 if(document.all.item(sd+x).options[i].selected)
111 {
112 s=s+document.all.item(sd+x).options[i].value +" ";
113 //alert(s);
114 break;
115 }
116 }
117
118
119 // alert(s);
120 }
121 alert(s);
122 document.forms[0].elements[3].value=s;
123 //document.forms[0].submit(); 这行为点击自动提交。
124
125 }
126 </SCRIPT></P><P>
127 <BR/>
128 <br/>
129 <center>
130 请在下面选择查询条件
131 </center> </P>
132 <table width="90%" border=1 align="center" cellpadding="0" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF" id=myTable name=myTable>
133 <tr bgcolor="#DBDBDB">
134 <td><div align="center">字段名</div></td>
135 <td><div align="center">比较符</div></td>
136 <td><div align="center">查询值</div></td>
137 <td><div align="center">关连符</div></td>
138 </tr>
139 </table>
140 <p align ="center"><a href="javascript:delRow()">删除条件</a>
141 <a href="javascript:lookdate()">查询</a></p>
142 <FORM action="display.jsp" method="get" name="sql" >
143 <table width="100%" border="1">
144 <tr>
145 <td width="85%">
146 <INPUT type="hidden" name="sqltext" value="">
147 SELECT
148 <INPUT name="sqltext1" type="text" value=" *" size="32">
149 From
150 <INPUT name="tablename" type="text" id="sqltext2" size="16" value="all200612">
151 Where
152 <INPUT name="sqltext3" type="text" id="sqltext3" value=" rownum<100" size="32">
153 <INPUT type="Submit" name="button1" value="提交" />
154 </td>
155
156 </tr>
157 </table>
158 </FORM>
159 <p>
160 <center>
161 选择完成后请点击查询
162 </center>
163 </p>
164
165
166
167 </body>
168</html>
169
170
171