JavaWeb项目开发案例精粹-第6章报价管理系统-07View层

1.

2.back_index.html

 1 <HTML>
 2 <HEAD>
 3 <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=gbk">
 4 <TITLE>报价管理系统</TITLE>
 5 </HEAD>
 6 
 7   <FRAMESET  cols = "130,*" frameborder=yes bordercolor=silver>
 8      <FRAME SRC="outlook.html" NAME="Links" SCROLLING="No">
 9      <FRAME SRC="main.html" NAME="main" SCROLLING="AUTO">
10   </FRAMESET>
11 <NOFRAMES>
12 <BODY>
13 </BODY>
14 
15 </NOFRAMES>
16 
17 </HTML>

 

3.

 1 <HTML>
 2 <HEAD>
 3 <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=GBK">
 4 <TITLE>导航栏</TITLE>
 5 <STYLE>
 6   div    {
 7          position:absolute;
 8          }
 9 </STYLE>
10 
11 <script language="JavaScript" src="crossbrowser.js" type="text/javascript">
12 </script>
13 <script language="JavaScript" src="outlook.js" type="text/javascript">
14 </script>
15 
16 <SCRIPT>
17   //create OutlookBar
18   var o = new createOutlookBar('Bar',0,0,screenSize.width,screenSize.height,'#606060','white')//'#000099')
19   var p
20 
21   //create first panel
22   p = new createPanel('customer','客户');
23   p.addButton('images/c.png','客户管理','parent.main.location="control/customer.do"');
24   p.addButton('images/cq.png','查询客户','parent.main.location="control/customermanage_query.do"');
25   o.addPanel(p);
26   
27   p = new createPanel('product','产品');
28   p.addButton('images/pt.png','产品类别管理','parent.main.location="control/producttype.do"');
29   p.addButton('images/ptq.png','产品类别查询','parent.main.location="control/producttypemanage_query.do"');
30   p.addButton('images/p.png','产品管理','parent.main.location="control/product.do"');
31   p.addButton('images/pq.png','产品查询','parent.main.location="control/productmanage_query.do"');
32   o.addPanel(p);
33 
34   p = new createPanel('order','订单');
35   p.addButton('images/o.png','订单管理','parent.main.location="control/order.do"');
36   p.addButton('images/oq.png','订单查询','parent.main.location="control/ordermanage_query.do"');
37   o.addPanel(p);
38 
39   p = new createPanel('quotation','报价');
40   p.addButton('images/q.png','报价管理','parent.main.location="control/quotation.do"');
41   p.addButton('images/qq.png','报价查询','parent.main.location="control/quotationmanage_query.do"');
42   o.addPanel(p);
43   
44   p = new createPanel('user','用户');
45   p.addButton('images/u.png','用户管理','parent.main.location="control/user.do"');
46   p.addButton('images/uq.png','用户查询','parent.main.location="control/usermanage_query.do"');
47   o.addPanel(p);
48   o.draw();
49 
50 function resize_op5() {
51   if (bt.op5) {
52     o.showPanel(o.aktPanel);
53     var s = new createPageSize();
54     if ((screenSize.width!=s.width) || (screenSize.height!=s.height)) {
55       screenSize=new createPageSize();
56       setTimeout("o.resize(0,0,screenSize.width,screenSize.height)",100);
57     }
58     setTimeout("resize_op5()",100);
59   }
60 }
61 
62 //resize IE & NS (onResize event!)
63 function myOnResize() {
64   if (bt.ie4 || bt.ie5 || bt.ns5) {
65     var s=new createPageSize();
66     o.resize(0,0,s.width,s.height);
67   }
68   else
69     if (bt.ns4) location.reload();
70 }
71 
72 </SCRIPT>
73 </head>
74 <body onLoad="resize_op5();" onResize="myOnResize();">
75 </body>
76 </html>

 

4.main.html

  1 <HTML>
  2 <HEAD>
  3   <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=gbk">
  4   <TITLE>报价管理系统首页</TITLE>
  5 <style type="text/css">  
  6 <!--
  7 a{ color:#008EE3}
  8 a:link  { text-decoration: none;color:#008EE3}
  9 A:visited {text-decoration: none;color:#666666}
 10 A:active {text-decoration: underline}
 11 A:hover {text-decoration: underline;color: #0066CC}
 12 A.b:link {
 13     text-decoration: none;
 14     font-size:12px;
 15     font-family: "Helvetica,微软雅黑,宋体";
 16     color: #FFFFFF;
 17 }
 18 A.b:visited {
 19     text-decoration: none;
 20     font-size:12px;
 21     font-family: "Helvetica,微软雅黑,宋体";
 22     color: #FFFFFF;
 23 }
 24 A.b:active {
 25     text-decoration: underline;
 26     color: #FF0000;
 27 
 28 }
 29 A.b:hover {text-decoration: underline; color: #ffffff}
 30 
 31 .table1 {
 32     border: 1px solid #CCCCCC;
 33 }
 34 .font {
 35     font-size: 12px;
 36     text-decoration: none;
 37     color: #999999;
 38     line-height: 20px;
 39     
 40 
 41 }
 42 .input {
 43     font-size: 12px;
 44     color: #999999;
 45     text-decoration: none;
 46     border: 0px none #999999;
 47 
 48 
 49 }
 50 
 51 td {
 52     font-size: 12px;
 53     color: #007AB5;
 54 }
 55 form {
 56     margin: 1px;
 57     padding: 1px;
 58 }
 59 input {
 60     border: 0px;
 61     height: 26px;
 62     color: #007AB5;
 63     .unnamed1 {
 64     border: thin none #FFFFFF;
 65 }
 66 .unnamed1 {
 67     border: thin none #FFFFFF;
 68 }
 69 select {
 70     border: 1px solid #cccccc;
 71     height: 18px;
 72     color: #666666;
 73 
 74     .unnamed1 {
 75     border: thin none #FFFFFF;
 76 }
 77 body {
 78     background-repeat: no-repeat;
 79     background-color: #9CDCF9;
 80     background-position: 0px 0px;
 81 
 82 }
 83 .tablelinenotop {
 84     border-top: 0px solid #CCCCCC;
 85     border-right: 1px solid #CCCCCC;
 86     border-bottom: 0px solid #CCCCCC;
 87     border-left: 1px solid #CCCCCC;
 88 }
 89 .tablelinenotopdown {
 90 
 91     border-top: 1px solid #eeeeee;
 92     border-right: 1px solid #eeeeee;
 93     border-bottom: 1px solid #eeeeee;
 94     border-left: 1px solid #eeeeee;
 95 }
 96 .style6 {FONT-SIZE: 9pt; color: #7b8ac3; }
 97 .STYLE9 {font-size: 24px}
 98 
 99 -->
100 </style>
101 </head>
102 <body>
103 
104 <table width="681" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:20px">
105   <tr>
106       <td align="center"><span class="STYLE9">欢迎使用报价管理系统</span></td>
107   </tr>
108   <tr>
109       <td>
110       <p>&nbsp;&nbsp;报价管理系统可以分为五个功能模块,分别是客户管理模块、产品管理模块、订单管理模块、报价管理模块以及系统用户管理模块,其中各功能模块的具体说明如下。</p>
111     <p>客户管理模块:该模块主要用来管理客户信息,包括客户的名称、联系电话、联系地址、联系人等信息。</p>
112     <p>产品管理模块:该模块主要用来管理产品类别和产品信息,包括产品的名称、产品的单位、产品的价格等信息。</p>
113     <p>订单管理模块:该模块主要用来管理订单信息,包括下单客户名称、产品名称、产品数量等信息。</p>
114     <p>报价管理模块:该模块主要用来管理报价信息,包括客户名称、产品名称、报价人、报价时间等信息。</p>
115     <p>系统用户管理模块:该模块用来管理系统用户信息,包括用户名、用户级别、用户密码等信息。</p>
116       </td>
117       <tr>
118   </tr>
119 </table>
120 </body>
121 </html>

 

5.outlook.js

  1 // ---------------------------------------------------------------------------
  2 // this script is copyright (c) 2001 by Michael Wallner!
  3 // http://www.wallner-software.com
  4 // mailto:dhtml@wallner-software.com
  5 //
  6 // you may use this script on web pages of your own
  7 // you must not remove this copyright note!
  8 //
  9 // This script featured on Dynamic Drive (http://www.dynamicdrive.com)
 10 // Visit http://www.dynamicdrive.com for full source to this script and more
 11 // ---------------------------------------------------------------------------
 12 
 13 // ---------------------------------------------------------------------------
 14 //                   Outlook like navigation bar version 1.2
 15 //
 16 // supported browsers:  IE4, IE5, NS4, NS6, MOZ, OP5
 17 // needed script files: crossbrowser.js
 18 //
 19 // History:
 20 // 1.0: initial version
 21 // 1.1: no Reload in IE and NS6
 22 // 1.2: no Reload in OP5 if width is not changed
 23 // ---------------------------------------------------------------------------
 24 
 25 //add one button to a panel
 26 //einen Button zu einem Panel hinzufügen
 27 //img:    image name - Name der Bilddatei
 28 //label:  button caption - Beschriftung des Buttons
 29 //action: javascript on MouseUp event - Javascript beim onMouseUp event
 30 function b_addButton(img, label, action) {
 31   this.img[this.img.length]=img;
 32   this.lbl[this.lbl.length]=label;
 33   this.act[this.act.length]=action;
 34   this.sta[this.sta.length]=0;
 35 
 36   return this
 37 }
 38 
 39 //reset all panel buttons  (ns4, op5)
 40 //alle Panel Buttons zurücksetzten (ns4, op5)
 41 function b_clear() {
 42 var i
 43   for (i=0;i<this.sta.length;i++) {
 44     if (this.sta[i] != 0)
 45       this.mOut(i);
 46   }
 47 }
 48 
 49 
 50 //----------------------------------------------------------------------------
 51 // Panel functions for Netscape 4
 52 //----------------------------------------------------------------------------
 53 
 54 // write new htmlcode into the button layer
 55 // schreibe den neuen HTML Code in den Button Layer
 56 function b_mOver_ns4(nr) {
 57   this.clear();
 58   l=this.obj.layers[0].layers[nr].document;
 59   l.open();
 60   l.write("<Center>")
 61   l.write("<SPAN class='imgbout'>")
 62   l.write("<A href='#' onmouseOut='"+this.v+".mOut("+nr+")' ");
 63   l.write("onMousedown='"+this.v+".mDown("+nr+")'><img src='"+this.img[nr]);
 64   l.write("' border=0></A></SPAN><Font size=2 face=Arial color=white>");
 65   l.write(this.lbl[nr]+"</FONT><BR><BR>");
 66   l.close();
 67   this.sta[nr]=1;
 68 }
 69 
 70 function b_mOut_ns4(nr) {
 71   l=this.obj.layers[0].layers[nr].document;
 72   l.open();
 73   l.write("<Center>")
 74   l.write("<SPAN class='imgnob'>")
 75   l.write("<A href='#' onmouseOver='"+this.v+".mOver("+nr+")' ");
 76   l.write("onmouseOut='"+this.v+".mOut("+nr+")'><img src='"+this.img[nr]);
 77   l.write("' border=0></A></SPAN><Font size=2 Face=Arial color=white>");
 78   l.write(this.lbl[nr]+"</FONT><BR><BR>");
 79   l.close();
 80   this.sta[nr]=0;
 81 }
 82 
 83 function b_mDown_ns4(nr) {
 84   l=this.obj.layers[0].layers[nr].document;
 85   l.open();
 86   l.write("<Center>")
 87   l.write("<SPAN class='imgbin'>")
 88   l.write("<A href='#' onmouseOver='"+this.v+".mOver("+nr+")' ");
 89   l.write("onmouseOut='"+this.v+".mOut("+nr+")' onMouseup='"+this.act[nr]);
 90   l.write(";"+this.v+".mOver("+nr+")'><img src='"+this.img[nr]);
 91   l.write("' border=0></A></SPAN><Font size=2 Face=Arial color=white>");
 92   l.write(this.lbl[nr]+"</FONT><BR><BR>");
 93   l.close();
 94   this.sta[nr]=1;
 95 }
 96 
 97 //test if scroll buttons should be visible
 98 //teste ob Scroll-Buttons sichtbar sein sollen
 99 function b_testScroll_ns4() {
100 var i
101 var j
102 var k
103 
104   i=this.obj.clip.bottom;
105   j=this.obj.layers[0].clip.bottom;
106   k=parseInt(this.obj.layers[0].top);
107 
108   if (k==38)
109     this.obj.layers[2].visibility='hide';
110   else
111     this.obj.layers[2].visibility='show';
112 
113   if ((j+k)<i) {
114     this.obj.layers[3].visibility='hide';
115   }
116   else
117     this.obj.layers[3].visibility='show';
118 }
119 
120 //scroll the panel content up
121 //scrolle den Panel Inhalt nach Oben
122 function b_up_ns4(nr) {
123     this.ftop = this.ftop - 5;
124     this.obj.layers[0].top=this.ftop;
125     nr--
126     if (nr>0)
127       setTimeout(this.v+'.up('+nr+');',10);
128     else
129       this.testScroll();
130 }
131 
132 //scroll the panel content down
133 //scrolle den Panel Inhalt nach Unten
134 function b_down_ns4(nr) {
135     this.ftop = this.ftop + 5;
136     if (this.ftop>=38) {
137       this.ftop=38;
138       nr=0;
139     }
140     this.obj.layers[0].top=this.ftop;
141     nr--
142 
143     if (nr>0)
144       setTimeout(this.v+'.down('+nr+');',10);
145     else
146       this.testScroll();
147 }
148 
149 //----------------------------------------------------------------------------
150 // Panel functions for Opera5
151 //----------------------------------------------------------------------------
152 
153 //show one panelbutton layer and hide the others two
154 //zeige einen Panel Button Layer und verstecke die anderen beiden
155 function b_mOver_op5(nr) {
156   var obj0=getObj(this.name+'_b'+nr+'0')
157   var obj1=getObj(this.name+'_b'+nr+'1')
158   var obj2=getObj(this.name+'_b'+nr+'2')
159 
160   this.clear();
161   obj1.style.visibility="VISIBLE";
162   obj0.style.visibility="HIDDEN";
163   obj2.style.visibility="HIDDEN";
164   this.sta[nr]=1;
165 }
166 
167 function b_mOut_op5(nr) {
168   var obj0=getObj(this.name+'_b'+nr+'0')
169   var obj1=getObj(this.name+'_b'+nr+'1')
170   var obj2=getObj(this.name+'_b'+nr+'2')
171 
172   obj2.style.visibility="visible";
173   obj0.style.visibility="hidden";
174   obj1.style.visibility="hidden";
175   this.sta[nr]=1;
176 }
177 
178 function b_mDown_op5(nr) {
179   var obj0=getObj(this.name+'_b'+nr+'0')
180   var obj1=getObj(this.name+'_b'+nr+'1')
181   var obj2=getObj(this.name+'_b'+nr+'2')
182 
183   obj0.style.visibility="visible";
184   obj1.style.visibility="hidden";
185   obj2.style.visibility="hidden";
186   this.sta[nr]=1;
187 }
188 
189 // ---------------------------------------------------------------------------
190 // Panel functions for ie4, ie5, ns5, op5
191 // ---------------------------------------------------------------------------
192 
193 //test if scroll buttons should be visible
194 //teste ob Scroll-Buttons sichtbar sein sollen
195 function b_testScroll() {
196 
197   if (bt.op5) {
198     var i=parseInt(this.obj.style.pixelHeight);
199     var j=parseInt(this.objf.style.pixelHeight);
200   }
201   else {
202     var i=parseInt(this.obj.style.height);
203     var j=parseInt(this.objf.style.height);
204   }
205   var k=parseInt(this.objf.style.top);
206 
207 
208   if (k==38)
209     this.objm1.style.visibility='hidden';
210   else
211     this.objm1.style.visibility='visible';
212 
213   if ((j+k)<i) {
214     this.objm2.style.visibility='hidden';
215   }
216   else
217     this.objm2.style.visibility='visible';
218 }
219 
220 //scroll the panel content up
221 //scrolle den Panel Inhalt nach Oben
222 function b_up(nr) {
223     this.ftop = this.ftop - 5;
224     this.objf.style.top=this.ftop;
225     nr--
226     if (nr>0)
227       setTimeout(this.v+'.up('+nr+');',10);
228     else
229       this.testScroll();
230 }
231 
232 //scroll the panel content down
233 //scrolle den Panel Inhalt nach Unten
234 function b_down(nr) {
235     this.ftop = this.ftop + 5;
236     if (this.ftop>=38) {
237       this.ftop=38;
238       nr=0;
239     }
240     this.objf.style.top=this.ftop;
241     nr--
242 
243     if (nr>0)
244       setTimeout(this.v+'.down('+nr+');',10);
245     else
246       this.testScroll();
247 }
248 
249 // ---------------------------------------------------------------------------
250 // Panel object
251 // ---------------------------------------------------------------------------
252 
253 //create one panel
254 function createPanel(name,caption) {
255   this.name=name;                  // panel layer ID
256   this.ftop=38;                    // actual panel scroll position
257   this.obj=null;                   // panel layer object
258   this.objc=null;                  // caption layer object
259   this.objf=null;                  // panel field layer object
260   this.objm1=null;                 // scroll button up
261   this.objm2=null;                 // scroll button down
262   this.caption=caption;            // panel caption
263   this.img=new Array();            // button images
264   this.lbl=new Array();            // button labels
265   this.act=new Array();            // button actions
266   this.sta=new Array();            // button status (internal)
267   this.addButton=b_addButton;      // add one button to panel
268   this.clear=b_clear;              // reset all buttons
269   if (bt.ns4) {                          // functions for ns4
270     this.mOver=b_mOver_ns4;              // handles mouseOver event
271     this.mOut=b_mOut_ns4;                // handles mouseOut & mouseUp event
272     this.mDown=b_mDown_ns4;              // handles mouseDown event
273     this.testScroll=b_testScroll_ns4;    // test if scroll buttons visible
274     this.up=b_up_ns4;                    // scroll panel buttons up
275     this.down=b_down_ns4;                // scroll panel buttons down
276   }
277   if (bt.op5) {                          // functions for op5
278     this.mOver=b_mOver_op5;              // handles mouseOver event
279     this.mOut=b_mOut_op5;                // handles mouseOut & mouseUp event
280     this.mDown=b_mDown_op5;              // handles mouseDown event
281   }
282   if (!bt.ns4) {                     // functions for all browsers but ns4
283     this.testScroll=b_testScroll;    // test if scroll buttons should be visible
284     this.up=b_up;                    // scroll panel buttons up
285     this.down=b_down;                // scroll panel buttons down
286   }
287 
288   this.v = this.name + "var";   // global var of 'this'
289   eval(this.v + "=this");
290 
291   return this
292 }
293 
294 //add one panel to the outlookbar
295 function b_addPanel(panel) {
296   panel.name=this.name+'_panel'+this.panels.length
297   this.panels[this.panels.length] = panel;
298 }
299 
300 //write style sheets
301 //schreibe die Style sheets
302 function b_writeStyle() {
303 
304   document.write('<STYLE TYPE="text/css">');
305 
306   document.write('.button {width:300; text-align:center; font-family:arial;');
307   document.write(' font-size:12pt; cursor:hand; border-width:3;');
308   document.write(' border-style:outset; border-color:silver; ');
309   document.write('background-color:silver;}');
310 
311   document.write('.noLine {text-decoration:none;}');
312 
313   document.write('.imgB {color:white; font-family:arial; font-size:10pt;}');
314 
315   if (bt.op5) {
316     document.write('.imgbin {border-width:3; border-style:inset; ');
317     document.write('border-color:white;}');
318   }
319   else {
320     document.write('.imgbin {border-width:3; border-style:inset; ');
321     document.write('border-color:silver;}');
322   }
323 
324   if (bt.op5) {
325     document.write('.imgbout {border-width:3; border-style:outset; ');
326     document.write('border-color:white;}');
327   }
328   else {
329     document.write('.imgbout {border-width:3; border-style:outset; width:54;');
330     document.write('border-color:silver;}');
331   }
332   
333   document.write(' .imgnob {border-width:3; border-style:solid;width:54; ');
334   document.write('border-color:'+this.bgcolor+';}');
335 
336   document.write('</STYLE>');
337 
338 }
339 
340 // Draw the Outlook Bar
341 function b_draw() {
342 var i;
343 var j;
344 var t=0;
345 var h;
346 var c=0;
347 
348   this.writeStyle();
349 
350   if (bt.ns5 || bt.op5) c=6;       //two times border width
351 
352 
353 
354   if (bt.ns4) {                 //draw OutlookBar for ns4
355     //OutlookBar layer..
356     document.write('<layer bgcolor='+this.bgcolor+' name='+this.name+' left=');
357     document.write(this.xpos+' top='+this.ypos+' width='+this.width);
358     document.write(' clip="0,0,'+this.width+','+this.height+'">');
359 
360     //one layer for every panel...
361     for (i=0;i<this.panels.length;i++) {
362       document.write('<Layer name='+this.name+'_panel'+i+' width='+this.width);
363        document.write(' top='+i*28+' bgcolor='+this.bgcolor);
364        document.write(' clip="0,0,'+this.width+',');
365        document.write(this.height-(this.panels.length-1)*28+'">');
366 
367        //one layer to host the panel buttons
368        document.write('<Layer top=38 width='+this.width+'>');
369         mtop=0
370 
371         //one layer for every button
372         for (j=0;j<this.panels[i].img.length;j++) {
373           document.write('<Layer top='+mtop+' width='+this.width);
374           document.write('><Center><SPAN class=imgnob>');
375           document.write("<A href='#' onmouseOut='"+this.panels[i].v);
376           document.write(".rst("+j+")' onmouseOver='"+this.panels[i].v);
377           document.write(".mOver("+j+")'><img src='"+this.panels[i].img[j]);
378           document.write("' border=0></A></SPAN>");
379           document.write("<Font size=2 face=arial color=white>");
380           document.write(this.panels[i].lbl[j]+"</FONT><BR><BR>");
381          document.write('</Layer>');
382          mtop=mtop+this.buttonspace;
383         }
384 
385        document.write('</Layer>');
386 
387        //one layer for the panels caption
388        document.write('<Layer top=0 width='+this.width+' clip="0,0,');
389        document.write(this.width+',28" bgcolor=silver class=button ');
390        document.write('onmouseOver="'+this.panels[i].v+'.clear();">');
391        document.write('<A class=noLine href="javascript:'+this.v+'.showPanel(');
392        document.write(i+');" onmouseOver="'+this.panels[i].v+'.clear();">');
393        document.write('<Font Color=black class=noLine>'+this.panels[i].caption);
394        document.write('</Font></A></Layer>');
395 
396        //two layers for scroll-up -down buttons
397        document.write('<Layer visibility=hide top=40 left='+(this.width-20));
398        document.write('><A href="#" onClick="'+this.panels[i].v+'.down(16);" ');
399        document.write('onmouseOver="'+this.panels[i].v+'.clear();"><img ');
400        document.write('width=16 height=16 src=images/arrowup.gif border=0>');
401        document.write('</A></LAYER><Layer top=');
402        document.write((this.height-(this.panels.length)*28)+'<Layer top=');
403        document.write((this.height-(this.panels.length)*28)+' left=');
404        document.write((this.width-20)+'><A href="#" onClick="');
405        document.write(this.panels[i].v+'.up(16);" onmouseOver="');
406        document.write(this.panels[i].v+'.clear();"><img width=16 height=16 ');
407        document.write('src=images/arrowdown.gif border=0></A></LAYER>');
408 
409       document.write('</LAYER>');
410     }
411     document.write('</LAYER>');
412   }
413   else {                             //draw Outlook bar for all browsers but ns4
414 
415     //OutlookBar layer..
416     document.write('<DIV id='+this.name+' Style="position:absolute; left:');
417     document.write(this.xpos+'; top:'+this.ypos+'; width:'+this.width);
418     document.write('; height:'+this.height+'; background-color:'+this.bgcolor)
419     document.write('; clip:rect(0,'+this.width+','+this.height+',0)">');
420     h=this.height-((this.panels.length-1)*28)
421 
422     //one layer for every panel...
423     for (i=0;i<this.panels.length;i++) {
424       document.write('<DIV id='+this.name+'_panel'+i);
425       document.write(' Style="position:absolute; left:0; top:'+t);
426       document.write('; width:'+this.width+'; height:'+h+'; clip:rect(0px, ');
427       document.write(this.width+'px, '+h+'px, 0px); background-color:');
428       document.write(this.bgcolor+';">')
429       t=t+28;
430 
431        //one layer to host the panel buttons
432       document.write('<div id='+this.name+'_panel'+i);
433       document.write('_f Style="position:absolute; left:0; top:38; width:');
434       document.write(this.width+'; height:');
435       document.write((this.panels[i].img.length*this.buttonspace));
436       document.write('; background-color:'+this.bgcolor+';">')
437       mtop=0
438 
439       //one (ie4, ie5, ns5) or three layers (op5) for every button
440       for (j=0;j<this.panels[i].img.length;j++) {
441         if (bt.op5) {
442           document.write('<DIV id='+this.name+'_panel'+i+'_b'+j);
443           document.write('0 class=imgB Style="position:absolute; ');
444           document.write('visibility:hidden; left:0; width:'+this.width);
445           document.write('; top:'+mtop+'; text-align:center;">');
446           document.write('<img src='+this.panels[i].img[j]);
447           document.write(' class=imgbin onmouseUp=\''+this.panels[i].v);
448           document.write('.mOver('+j+');'+this.panels[i].act[j]);
449           document.write(';\' onmouseOut="'+this.panels[i].v+'.mOut('+j);
450           document.write(');"><BR>'+this.panels[i].lbl[j]+'</DIV>');
451 
452           document.write('<DIV id='+this.name+'_panel'+i+'_b'+j+'1 class=imgB');
453           document.write(' Style="position:absolute; visibility:hidden; ');
454           document.write('left:0; width:'+this.width+'; top:'+mtop);
455           document.write('; text-align:center;">');
456           document.write('<img src='+this.panels[i].img[j]);
457           document.write(' class=imgbout onmouseDown="'+this.panels[i].v);
458           document.write('.mDown('+j+');" onmouseUp=\''+this.panels[i].v);
459           document.write('.mOver('+j+');'+this.panels[i].act[j]);
460           document.write(';\' onmouseOut="'+this.panels[i].v+'.mOut('+j);
461           document.write(');"><BR>'+this.panels[i].lbl[j]+'</DIV>');
462 
463           document.write('<DIV id='+this.name+'_panel'+i+'_b'+j);
464           document.write('2 class=imgB Style="position:absolute; ');
465           document.write('visibility:visible; left:0; width:'+this.width);
466           document.write('; top:'+mtop+'; text-align:center;">');
467           document.write('<img src='+this.panels[i].img[j]+' class=imgnob ');
468           document.write('onmouseOver="'+this.panels[i].v+'.mOver('+j);
469           document.write(');"><BR>'+this.panels[i].lbl[j]+'</DIV>');
470         }
471         else {
472           document.write('<DIV id='+this.name+'_panel'+i+'_b'+j+' class=imgB ');
473           document.write('Style="position:absolute; left:0; width:'+this.width);
474           document.write('; top:'+mtop+'; text-align:center;">');
475           document.write('<img src='+this.panels[i].img[j]+' class=imgnob ');
476           document.write('onmouseOver="this.className=\'imgbout\';" ');
477           document.write('onmouseDown="this.className=\'imgbin\';" ');
478           document.write('onmouseUp=\'this.className="imgbout";');
479           document.write(this.panels[i].act[j]+';\' ');
480           document.write('onmouseOut="this.className=\'imgnob\';"><BR>');
481           document.write(this.panels[i].lbl[j]+'</DIV>');
482         }
483         mtop=mtop+this.buttonspace;
484       }
485 
486       document.write('</DIV>');
487 
488       //one layer for the panels caption if not op5!
489       if (!bt.op5) {
490         document.write('<DIV id='+this.name+'_panel'+i+'_c class=button ');
491         document.write('onClick="javascript:'+this.v+'.showPanel('+i);
492         document.write(');" style="position:absolute; left:0; top:0; width:');
493         document.write((this.width-c)+'; height:'+(28-c)+';"><A href="#" ');
494         document.write('onClick="'+this.v+'.showPanel('+i+');this.blur();');
495         document.write('return false;" class=noLine><FONT color=black ');
496         document.write('class=noLine">'+this.panels[i].caption);
497         document.write('</FONT></A></DIV>')
498       }
499       //two layers for scroll-up -down buttons
500       document.write('<DIV id='+this.name+'_panel'+i);
501       document.write('_m1 style="position:absolute; top:40; left:');
502       document.write((this.width-20)+';"><A href="#" onClick="');
503       document.write(this.panels[i].v+'.down(16);this.blur();return false;" ');
504       document.write('onmouseOver="'+this.panels[i].v+'.clear();">');
505       document.write('<img width=16 height=16 src=images/arrowup.gif border=0>');
506       document.write('</A></DIV>');
507       document.write('<DIV id='+this.name+'_panel'+i);
508       document.write('_m2 style="position:absolute;  top:');
509       document.write((this.height-(this.panels.length)*28)+'; left:');
510       document.write((this.width-20)+';"><A href="#" onClick="');
511       document.write(this.panels[i].v+'.up(16);this.blur();return false" ');
512       document.write('onmouseOver="'+this.panels[i].v+'.clear();">');
513       document.write('<img width=16 height=16 src=images/arrowdown.gif border=0>');
514       document.write('</A></DIV>');
515 
516 
517       document.write('</DIV>')
518 
519     }
520     //Opera bug (Clip!)
521     //op5 doesn't support layer clipping! so use top layers for panel caption
522     //and two top layers with background-color like page color to hide
523     //panel content outside of the outlookbar.
524     //op5 unterstützt kein Clip bei Layers! darum erzeugen wir drei top level
525     //layers für die Panel Überschrift und zwei top Layers mit der gleichen
526     //Hintergrundfarbe wie die HTML Seite um den Panel Inhalt außerhalb des
527     //Outlook Bars zu verdecken!
528     if (bt.op5) {
529       //one layers for panel captions if op5
530       for (i=0;i<this.panels.length;i++) {
531         document.write('<DIV id='+this.name+'_panel'+i);
532         document.write('_c class=button onmouseOver="'+this.panels[i].v);
533         document.write('.clear();" onClick="'+this.v+'.showPanel('+i);
534         document.write(');" style="position:absolute; left:0; top:0; width:');
535         document.write((this.width-c)+'; height:'+(28-c)+';">');
536         document.write('<A href="#" ');
537         document.write('onClick="'+this.v+'.showPanel('+i+');this.blur();');
538         document.write('return false;" class=noLine><FONT color=black ');
539         document.write('class=noLine">'+this.panels[i].caption);
540         document.write('</FONT></A></DIV>')
541       }
542       //two layers to hide 'nonvisible' part of panel
543       //(op5 doesn't support clipping!)
544       //document.write('<DIV style="position:absolute; left:0; top:');
545       //document.write(this.height+'; height:300; width:'+this.width);
546       //document.write('; background-color:'+this.pagecolor+';"></DIV>');
547       //document.write('<DIV style="position:absolute; left:0; top:-300; ');
548       //document.write('height:300; width:'+this.width+'; background-color:');
549       //document.write(this.pagecolor+';"></DIV>');
550     }
551     document.write('</DIV>');
552 
553   }
554   for (i=0;i<this.panels.length;i++) {
555     this.panels[i].obj=getObj(this.name+'_panel'+i);
556     if (!bt.ns4) {
557       this.panels[i].objc=getObj(this.name+'_panel'+i+'_c');
558       this.panels[i].objf=getObj(this.name+'_panel'+i+'_f');
559       this.panels[i].objm1=getObj(this.name+'_panel'+i+'_m1');
560       this.panels[i].objm2=getObj(this.name+'_panel'+i+'_m2');
561     }
562     this.panels[i].testScroll();
563   }
564 
565   //activate last panel
566   //op5 dosen't support cookies!
567   //so get actual panel from url paramter
568   if (bt.op5) {
569     if (document.location.search=='')  {
570       this.showPanel(0);
571     }
572     else
573       this.showPanel(document.location.search.substr(1,1));
574   }
575   else {
576     //actual panel is saved in a cookie
577     if (document.cookie)
578       this.showPanel(document.cookie);
579     else
580       this.showPanel(0);
581   }
582 }
583 
584 
585 // ---------------------------------------------------------------------------
586 // outlookbar function for ns4
587 // ---------------------------------------------------------------------------
588 
589 function b_showPanel_ns4(nr) {
590 var i
591 var l
592   document.cookie=nr;
593   l = this.panels.length;
594   for (i=0;i<l;i++) {
595     if (i>nr) {
596       this.panels[i].obj.top=this.height-((l-i)*28)-1;
597     }
598     else {
599       this.panels[i].obj.top=i*28;
600     }
601   }
602 }
603 
604 // ---------------------------------------------------------------------------
605 // outlookbar function for ie4, ie5, ns5, op5
606 // ---------------------------------------------------------------------------
607 
608 function b_showPanel(nr) {
609 var i
610 var l
611 var o
612   document.cookie=nr;
613   this.aktPanel=nr;
614   l = this.panels.length;
615   for (i=0;i<l;i++) {
616     if (i>nr) {
617       this.panels[i].obj.style.top=this.height-((l-i)*28);
618       //Opera doesn't support clip:rect()!
619       //so hide non visible panels
620       //and move panel caption
621       if (bt.op5) {
622         this.panels[i].objf.style.visibility='hidden';
623         this.panels[i].objc.style.top=this.height-((l-i)*28);
624       }
625     }
626     else {
627       this.panels[i].obj.style.top=i*28;
628       //Opera doesn't support clip:rect()!
629       //so show visible panel
630       //and move panel caption
631       if (bt.op5) {
632         this.panels[i].objf.style.visibility='visible';
633         this.panels[i].objc.style.top=i*28;
634       }
635     }
636   }
637 }
638 
639 //resize the Outlook Like Bar
640 //IE4/5 & NS6 -> resize all layers (width & height)
641 //op5         -> resize only height - reload on width change
642 //ns4         -> reload on any change!
643 //
644 //if you change the width of a layer (style="text-align:center;") then
645 //the content will not be moved!
646 function b_resize(x,y,width,height) {
647 var o
648 var i
649 var j
650 var h
651 var c=(bt.ns5)?6:0;
652 
653    if (bt.ns4)
654      location.reload();
655    else {
656      if (bt.op5 && (width!=this.width))
657        if (location.href.indexOf('?')!=-1)
658          location.href=location.href.replace(/\?./,"?"+this.aktPanel)
659        else
660          location.href= location.href+'?'+this.aktPanel;
661      else {
662        this.xpos=x;
663        this.yPos=y;
664        this.width=width
665        this.height=height
666 
667        o=getObj(this.name);
668        o.style.left=x;
669        o.style.top=y;
670        o.style.width=width;
671        o.style.height=height;
672        o.style.clip='rect(0px '+this.width+'px '+this.height+'px 0px)';
673 
674        h=this.height-((this.panels.length-1)*28)
675 
676        for (i=0; i<this.panels.length; i++) {
677 
678          o=getObj(this.name+'_panel'+i+'_c');
679          o.style.width=(this.width-c);
680 
681          if (!bt.op5)
682            for (j=0;j<this.panels[i].img.length;j++) {
683              o=getObj(this.name+'_panel'+i+'_b'+j);
684              o.style.width=this.width;
685            }
686 
687          this.panels[i].objm1.style.left=(this.width-20);
688          this.panels[i].objm2.style.top=(this.height-(this.panels.length)*28);
689          this.panels[i].objm2.style.left=(this.width-20);
690          this.panels[i].objf.style.width=this.width;
691          this.panels[i].obj.style.width=this.width
692          this.panels[i].obj.style.height=h
693          this.panels[i].obj.style.pixelHeight=h
694          this.panels[i].obj.style.clip='rect(0px '+this.width+'px '+h+'px 0px)';
695 
696          this.panels[i].testScroll();
697        }
698      }
699      this.showPanel(this.aktPanel);
700    }
701 }
702 
703 
704 
705 // ---------------------------------------------------------------------------
706 // OutlookBar object for ie4, ie5, ns5, op5
707 // ---------------------------------------------------------------------------
708 
709 function createOutlookBar(name,x,y,width,height,bgcolor,pagecolor) {
710   this.aktPanel=0;                        // last open panel
711   this.name=name                          // OutlookBar name
712   this.xpos=x;                            // bar x-pos
713   this.ypos=y;                            // bar y-pos
714   this.width=width;                       // bar width
715   this.height=height;                     // bar height
716   this.bgcolor=bgcolor;                   // bar background color
717   this.pagecolor=pagecolor;               // page bgcolor (op5!)
718   this.buttonspace=80                     // distance of panel buttons
719   this.panels=new Array()                 // OutlookBar panels
720   this.addPanel=b_addPanel;               // add new panel to bar
721   this.writeStyle=b_writeStyle;
722   this.draw=b_draw;                       // write HTML code of bar
723   if (bt.ns4)
724     this.showPanel=b_showPanel_ns4;       // make a panel visible (ns4)
725   else
726     this.showPanel=b_showPanel;           // make a panel visible (!=ns4)
727     
728   this.resize=b_resize;                   // resize Outlook Like Bar
729 
730   this.v = name + "var";                  // global var of 'this'
731   eval(this.v + "=this");
732 
733   return this
734 }

 

6.crossbrowser.js

  1 // ---------------------------------------------------------------------------
  2 // this script is copyright (c) 2001 by Michael Wallner!
  3 // http://www.wallner-software.com
  4 // mailto:dhtml@wallner-software.com
  5 //
  6 // you may use this script on web pages of your own
  7 // you must not remove this copyright note!
  8 //
  9 // This script featured on Dynamic Drive (http://www.dynamicdrive.com)
 10 // Visit http://www.dynamicdrive.com for full source to this script and more
 11 // ---------------------------------------------------------------------------
 12 
 13 
 14 // ---------------------------------------------------------------------------
 15 //                 crossbrowser DHTML functions version 1.0
 16 //
 17 // supported browsers:  IE4, IE5, NS4, NS6, MOZ, OP5
 18 // ---------------------------------------------------------------------------
 19 
 20 
 21 //get browser info
 22 //ermittle den verwendeten Browser
 23 //Unterstόtzt IE4, IE5, IE6?, NS4, NS6, Mozilla5 und Opera5
 24 //(Achtung op5 kann sich auch als NS oder IE ausgeben!)
 25 function browserType() {
 26   this.name = navigator.appName;
 27   this.version = navigator.appVersion;                    //Version string
 28   this.dom=document.getElementById?1:0                            //w3-dom
 29   this.op5=(this.name.indexOf("Opera") > -1 && (this.dom))?1:0     //Opera Browser
 30   this.ie4=(document.all && !this.dom)?1:0                       //ie4
 31   this.ie5=(this.dom && this.version.indexOf("MSIE ") > -1)?1:0         //IE5, IE6?
 32   this.ns4=(document.layers && !this.dom)?1:0                       //NS4
 33   this.ns5=(this.dom && this.version.indexOf("MSIE ") == -1)?1:0 //NS6, Mozilla5
 34 
 35   //test if op5 telling "i'm ie..." (works because op5 doesn't support clip)
 36   //testen ob sich ein op5 als ie5 'ausgibt' (funktioniert weil op5 kein clip
 37   //unterstόtzt)
 38   if (this.ie4 || this.ie5) {
 39     document.write('<DIV id=testOpera style="position:absolute; visibility:hidden">TestIfOpera5</DIV>');
 40     if (document.all['testOpera'].style.clip=='rect()') {
 41       this.ie4=0;
 42       this.ie5=0;
 43       this.op5=1;
 44     }
 45   }
 46 
 47   this.ok=(this.ie4 || this.ie5 || this.ns4 || this.ns5 || this.op5) //any DHTML
 48   eval ("bt=this");
 49 }
 50 browserType();
 51 
 52 
 53 //crossbrowser replacement for getElementById (find ns4 sublayers also!)
 54 //ersetzte 'getElementById' (findet auch sublayers in ns4)
 55 function getObj(obj){
 56 //do not use 'STYLE=' attribut in <DIV> tags for NS4!
 57 //zumindest beim NS 4.08 dόrfen <DIV> Tags keine 'STYLE=' Angabe beinhalten
 58 //sonst werden die restlichen Layers nicht gefunden! class= ist jedoch erlaubt!
 59 
 60   //search layer for ns4
 61   //Recursive Suche nach Layer fόr NS4
 62   function getRefNS4(doc,obj){
 63     var fobj=0;
 64     var c=0
 65       while (c < doc.layers.length) {
 66         if (doc.layers[c].name==obj) return doc.layers[c];
 67     fobj=getRefNS4(doc.layers[c].document,obj)
 68     if (fobj != 0) return fobj
 69     c++;
 70       }
 71       return 0;
 72   }
 73 
 74   return (bt.dom)?document.getElementById(obj):(bt.ie4)?
 75          document.all[obj]:(bt.ns4)?getRefNS4(document,obj):0
 76 }
 77 
 78 
 79 //get the actual browser window size
 80 //ermittle die grφίe der Browser Anzeigeflδche
 81 //op5 supports offsetXXXX ans innerXXXX but offsetXXXX only after pageload!
 82 //op5 unterstόtzt sowohl innerXXXX als auch offsetXXXX aber offsetXXXX erst
 83 //nach dem vollstδndigen Laden der Seite!
 84 function createPageSize(){
 85   this.width=(bt.ns4 || bt.ns5 || bt.op5)?innerWidth:document.body.offsetWidth;
 86   this.height=(bt.ns4 || bt.ns5 || bt.op5)?innerHeight:document.body.offsetHeight;
 87   return this;
 88 }
 89 var screenSize = new createPageSize();
 90 
 91 //create a crossbrowser layer object
 92 function createLayerObject(name) {
 93   this.name=name;
 94   this.obj=getObj(name);
 95   this.css=(bt.ns4)?obj:obj.style;
 96   this.x=parseInt(this.css.left);
 97   this.y=parseInt(this.css.top);
 98   this.show=b_show;
 99   this.hide=b_hide;
100   this.moveTo=b_moveTo;
101   this.moveBy=b_moveBy;
102   this.writeText=b_writeText;
103   return this;
104 }
105   
106 //crossbrowser show
107 function b_show(){
108 //  this.visibility='visible'
109   this.css.visibility='visible';
110 }
111 
112 //crossbrowser hide
113 function b_hide(){
114 //  this.visibility='hidden'
115   this.css.visibility='hidden';
116 }
117 
118 //crossbrowser move absolute
119 function b_moveTo(x,y){
120   this.x = x;
121   this.y = y;
122   this.css.left=x;
123   this.css.top=y;
124 }
125 
126 //crossbrowser move relative
127 function b_moveBy(x,y){
128   this.moveTo(this.x+x, this.y+y)
129 }
130 
131 //write text into a layer (not supported by Opera 5!)
132 //this function is not w3c-dom compatible but ns6
133 //support innerHTML also!
134 //Opera 5 does not support change of layer content!!
135 function b_writeText(text) {
136    if (bt.ns4) {
137      this.obj.document.write(text);
138      this.obj.document.close();
139    }
140    else {
141      this.obj.innerHTML=text;
142    }
143 }

 

7.script/public.js

  1 /*
  2  * 打开新窗口
  3  * f:链接地址
  4  * n:窗口的名称
  5  * w:窗口的宽度
  6  * h:窗口的高度
  7  * s:窗口是否有滚动条,1:有滚动条;0:没有滚动条
  8  */
  9 function openWin(f,n,w,h,s){
 10     sb = s == "1" ? "1" : "0";
 11     l = (screen.width - w)/2;
 12     t = (screen.height - h)/2;
 13     sFeatures = "left="+ l +",top="+ t +",height="+ h +",width="+ w
 14             + ",center=1,scrollbars=" + sb + ",status=0,directories=0,channelmode=0";
 15     openwin = window.open(f , n , sFeatures );
 16     if (!openwin.opener)
 17         openwin.opener = self;
 18     openwin.focus();
 19     return openwin;
 20 }
 21 
 22 /*
 23  * 打开删除窗口
 24  */
 25 function openDeleteDialog(url,confirmString){
 26     var c = confirmString;
 27     if(c == null || c == ''){
 28         c = "你确认要删除记录吗?";
 29     }
 30     if(confirm(c)){
 31         return window.showModalDialog(url,"window123","dialogHeight:234px;dialogWidth:271px;resizable:no;help:yes;status:no;scroll:no");
 32     }
 33     return false;
 34 }
 35 
 36 /*
 37  * 删除记录
 38  */
 39 function del(url,info){
 40     if(openDeleteDialog(url,info)){
 41         window.location.reload(true);
 42     }
 43 }
 44 
 45 /*
 46  * 校验checkbox
 47  */
 48 function checkAll( chkName, checkboxName, pageSize ) {
 49     var src = event.srcElement;
 50     var chkN=eval("document.all."+chkName);
 51 
 52     if (src.checked) {
 53         chkN[0].checked = true;
 54         chkN[1].checked = true;
 55         for(var i=0; i<pageSize; i++) {
 56             var chk = eval("document.all." + checkboxName + i);
 57             if (chk) {
 58                 chk.checked=true;
 59             }
 60         }
 61     } else {
 62         chkN[0].checked = false;
 63         chkN[1].checked = false;
 64         for(var i=0; i<pageSize; i++) {
 65             var chk = eval("document.all." + checkboxName + i);
 66             if(chk) {
 67                 chk.checked=false;
 68             }
 69         }
 70     }
 71 }
 72 
 73 /*
 74  * 
 75  */
 76 function makePages(maxPage, selectedPage, selectName) {
 77     var sel=eval("document.all."+selectName);
 78     sel.length=0;
 79     for(var i=1; i<=maxPage; i++) {
 80         sel.options[i]=new Option(i,i);
 81         if(sel.options[i]==selectedPage) {
 82             sel.options[i].selected=true;
 83         }
 84     }
 85 }
 86 
 87 /*
 88  * 替换字符串
 89  */
 90 function replaceStr( str ) {
 91     var re="/( )/gi";
 92     str = str.replace(re,"");
 93     re="/\</gi";
 94     str = str.replace(re,"&lt;");
 95 
 96     return str;
 97 }
 98 
 99 /*
100  * 去掉左边空格
101  */
102 function LTrim(str) {
103     var whitespace = new String(" \t\n\r");
104     var s = new String(str);
105     if (whitespace.indexOf(s.charAt(0)) != -1) {
106         var j=0, i = s.length;
107         while (j < i && whitespace.indexOf(s.charAt(j)) != -1) {
108            j++;
109         }
110         s = s.substring(j, i);
111     }
112     return s;
113 }
114 
115 /*
116  * 去掉右边空格
117  */
118 function RTrim(str) {
119     var whitespace = new String(" \t\n\r");
120     var s = new String(str);
121     if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
122         var i = s.length - 1;
123         while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) {
124             i--;
125         }
126         s = s.substring(0, i+1);
127     }
128     return s;
129 }
130 
131 /*
132  * 去掉两边空格
133  */
134 function Trim(str) {
135     return RTrim(LTrim(str));
136 }
137 
138 /*
139  *
140  */
141 function exeOperation( exePath ){
142     var obj = new ActiveXObject("Microsoft.XMLHTTP");
143     obj.open("post",exePath,false);
144     obj.send();
145     var res = obj.responseText;
146     var rs = Trim(res);
147     if (rs.indexOf('true',0) != -1) {
148         return true;
149     } else {
150         return false;
151     }
152 }
153 
154 /*
155  *
156  */
157 function exeValidate( exePath ){
158     var obj = new ActiveXObject("Microsoft.XMLHTTP");
159     obj.open("post",exePath,false);
160     obj.send();
161     var res = obj.responseText;
162     var rs = Trim(res);
163     if (rs.indexOf('validate_login_user',0) != -1) {
164         return true;
165     } else {
166         return false;
167     }
168 }
169 
170 /*
171  * 显示
172  */
173 function validate_date( exePath ) {
174      var obj = new ActiveXObject("Microsoft.XMLHTTP");
175      obj.open("post",exePath,false);
176      obj.send();
177      var res = obj.responseText;
178      var rs = Trim(res);
179      var begin_str = "<!--begin-->";
180      var beginIndex = rs.indexOf(begin_str) + begin_str.length;
181      var endIndex   = rs.indexOf("<!--end-->");
182      rs = ((beginIndex >= 0) && (endIndex >= 0)) ? rs.substring(beginIndex,endIndex) : "";
183      return Trim(rs);
184 }
185 
186 /*
187  * 校验是否数字
188  */
189 function checkNumber(name, TempS) {
190     for(Count=0;Count<TempS.length;Count++) {
191         TempChar=TempS.substring(Count,Count+1);
192         RefString="0123456789";
193         if (RefString.indexOf(TempChar,0)==-1) {
194             alert("请输入数字");
195             eval("document.all." + name).focus();
196             return false;
197         }
198     }
199 }
200 
201 /*
202  * 是否有非法字符
203  */
204 function chksafe(a){
205     fibdn = new Array ("'" ,"\\");
206     i=fibdn.length;
207     j=a.length;
208     for (ii=0; ii<i; ii++) {
209         for (jj=0; jj<j; jj++) {
210             temp1=a.charAt(jj);
211             temp2=fibdn[ii];
212             if (temp1==temp2){
213                 return false;
214             }
215         }
216     }
217     return true;
218 }
219 
220 /*
221  *
222  */
223 function fucCheckNUM(NUM){
224     var i,j,strTemp;
225     strTemp="0123456789";
226     if ( NUM.length== 0)  
227         return false;
228     for (i=0;i<NUM.length;i++) {
229         j=strTemp.indexOf(NUM.charAt(i));
230         if (j==-1){
231             return false;
232         }
233     }
234     return true;
235 }
236 
237 /*
238  *
239  */
240 function fucCheckLength(strTemp) {
241     var i,sum;
242     sum=0;
243     for(i=0;i<strTemp.length;i++) {
244         if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=255)) {
245             sum=sum+1;
246         } else {
247             sum=sum+2;
248         }
249     }
250     return sum;
251 }
252 
253 /*
254  *
255  */
256 function chkElements( name, errMsg, max_length, lengthMsg ) {
257     var el_name = eval("document.all." + name);
258     var v = el_name.value;
259     if (!chksafe(v)) {
260         el_name.focus();
261         alert(errMsg);
262         return false;
263     } else if (fucCheckLength(v) > max_length) {
264         el_name.focus();
265         alert(lengthMsg);
266         return false;
267     }
268     return true;
269 }
270 
271 /*
272  * 校验空字符串
273  */
274 function checkNullStr(name, msg) {
275     var el_name = eval("document.all."+name);
276     if (Trim(el_name.value).length==0) {
277         alert(msg);
278         el_name.focus();
279         return false;
280     }
281     return    true;
282 }
283 
284 /*
285  * 显示日期控件
286  */
287 function GetDate(nText,para){
288     var v_url = para=="1"?"./common/data.html":"../../common/data.html";
289       var reVal = window.showModalDialog(v_url, 'data',"status:no;center:yes;scroll:no;resizable:no;dialogWidth:255px;dialogHeight:260px");
290       if (reVal != null) {
291         var n = eval("document.all." + nText);
292         n.value=reVal;
293       }
294 }
295 
296 /*
297  * 按比例缩小图片
298  */
299 function DrawImage(ImgD,iwidth,iheight){
300     var flag=false;
301     var image=new Image();
302     image.src=ImgD.src;
303     if(image.width>0 && image.height>0){
304         flag=true;
305         if(image.width/image.height>= iwidth/iheight){
306             if(image.width>iwidth){ 
307                 ImgD.width=iwidth;
308                 ImgD.height=(image.height*iwidth)/image.width;
309             }else{
310                 ImgD.width=image.width; 
311                 ImgD.height=image.height;
312             }
313 //            ImgD.alt=image.width+"×"+image.height;
314         }else{
315             if(image.height>iheight){ 
316                 ImgD.height=iheight;
317                 ImgD.width=(image.width*iheight)/image.height; 
318             }else{
319                 ImgD.width=image.width; 
320                 ImgD.height=image.height;
321             }
322 //            ImgD.alt=image.width+"×"+image.height;
323         }
324     }
325     ImgD.style.visibility = "visible";
326 } 
327 
328 /*
329  * 回车键转为Tab键
330  */
331 function enterTab(){
332     if(event.keyCode==13){
333         oElement = document.activeElement;
334         if(oElement.tagName != "TEXTAREA" && oElement.type != "button")
335             event.keyCode=9;
336         return ;
337        }
338 }
339 
340 /*
341  *
342  */
343 function objectEval(text) {
344     text = text.replace(/\n/g, " ");
345     text = text.replace(/\r/g, " ");
346     if (text.match(/^\s*\{.*\}\s*$/)) {
347         text = "[" + text + "]";
348     }
349     return eval(text)[0];
350 }
351 
352 /*
353  * 打开领导查询页面
354  * action    - 查询的Action
355  * method    - 调用的方法
356  * title    - 标题message
357  * name        - 员工选择域的name
358  */
359 function openLeaderQuery(action,method,title,name){
360     openWin("../../common/selectStaff.jsp?action="+action+"&method="+method+"&title="+title+"&name="+name,"public_leader_find_page","400","150");
361 }
362 
363 /*
364  * 第一行变色
365  */
366 function chgColor(){
367     var v_table = document.all["PowerTable"];
368     var v_row = v_table.rows[1];
369     var len = v_row.cells.length;
370     for(var i=0;i<len;i++){
371         var v_cell = v_row.cells[i];
372         v_cell.style.backgroundColor = "yellow";
373     }
374 }
375 
376 /*
377  * 第一行变色
378  */
379 function chgColor2(){
380     var v_table = document.all["PowerTable"];
381     var rows_count=v_table.rows.length;
382     var v_row,v_cell,temp_len,len;
383     var rowspan=0;
384     
385     //get rowspan
386     if (v_table.rows.length > 1) {
387         len = v_table.rows[1].cells.length;
388         for (var r=2; r < rows_count; r++) {
389             v_row = v_table.rows[r];
390             temp_len = v_row.cells.length;
391             if (temp_len==len) {
392                 rowspan=r-1;
393                 break;
394             }
395         }
396         
397         rowspan=(rowspan>0) ? (rowspan+1) : rows_count;        
398         for(var r=1; r < rowspan; r++) {
399             v_row=v_table.rows[r];
400             for (var t=0; t < v_row.cells.length; t++) {
401                 v_cell = v_row.cells[t];
402                 v_cell.style.backgroundColor = "yellow";
403             }
404         }            
405     }    
406 }
407 
408 /*
409  * 添加页面载入后触发的事件
410  */
411 function addLoadEvent(func) {
412     var oldonload = window.onload;
413     if (typeof(window.onload) != "function") {
414         window.onload = func;
415     } else {
416         window.onload = function() {
417             oldonload();
418             func();
419         }
420     }
421 }
422 //adsName:名称,adsUrl:地址,sTime:时间(小时) add by wujie 2005.12.12
423 function PopAds(adsName,adsUrl,sTime,number,w,h,s)
424 {
425     if(document.cookie.indexOf(adsName)==-1)
426     {
427         window.open(adsUrl,adsName);
428         self.focus();
429                 var expireDate = new Date();
430                 var lefttime = 1000 * (3600 * sTime);
431                 expireDate.setTime (expireDate.getTime() + lefttime);
432                 document.cookie = adsName +"=yes" + "; expires=" + expireDate.toGMTString() +  ";";
433     }
434 openWin(adsUrl,number,w,h,s);
435 }
436 document.onkeydown=enterTab;

 

8.customer/customer_add.jsp

 1 <%@ page language="java" contentType="text/html; charset=GB18030"
 2     pageEncoding="GB18030"%>
 3 <%@include file="/share/taglib.jsp" %>
 4 <%
 5     String path = request.getContextPath();
 6     String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 7 %>
 8 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 9 <html>
10 <head>
11 <meta http-equiv="Content-Type" content="text/html; charset=GB18030">
12 <link href="<%=basePath%>style/oa.css" rel="stylesheet" type="text/css">
13 <script language="javascript" src="<%=basePath%>script/public.js"></script>
14 <title>新增客户信息</title>
15 </head>
16 <body>
17 <center>
18 <form action="customermanage_add.do" method="post">
19 <TABLE class="tableEdit" border="0" cellspacing="1" cellpadding="0" style="width:580px;">
20     <TBODY>
21         <TR>
22             <!-- 这里是添加、编辑界面的标题 -->
23             <td align="center" class="tdEditTitle">新增客户信息</TD>
24         </TR>
25         <TR>
26             <td>
27             <!-- 主输入域开始 -->
28 <table class="tableEdit" style="width:580px;" cellspacing="0" border="0" cellpadding="0">
29     <tr>
30         <td class="tdEditLabel" >客户编号</td>            
31         <td class="tdEditContent"><input type="text" name="customerNO">
32         </td>
33         <td class="tdEditLabel" >客户名称</td>            
34         <td class="tdEditContent"><input type="text" name="customerName"></td>
35     </tr>
36     <tr>
37         <td class="tdEditLabel" >联系电话</td>            
38         <td class="tdEditContent"><input type="text" name="phone">
39         </td>
40         <td class="tdEditLabel" >联系地址</td>            
41         <td class="tdEditContent"><input type="text" name="address"></td>
42     </tr>
43     <tr>
44         <td class="tdEditLabel" >联系人</td>            
45         <td class="tdEditContent"><input type="text" name="relationman">
46         </td>
47         <td class="tdEditLabel" >其他</td>            
48         <td class="tdEditContent"><input type="text" name="otherInfo"></td>
49     </tr>
50 </table>
51             <!-- 主输入域结束 -->
52             </td>
53         </TR>
54     </TBODY>
55 </TABLE>
56 <TABLE>
57         <TR align="center">
58             <TD colspan="3" bgcolor="#EFF3F7">
59             <input type="submit" name="saveButton"
60                 class="MyButton" value="保存客户信息"> 
61             <input type="button" class="MyButton"
62                 value="关闭窗口" onclick="window.close()">
63             </TD>
64         </TR>
65 </TABLE>
66 </form>
67 </center>
68 </body>
69 </html>

 

9.customer/customer_list.jsp

  1 <%@ page language="java" contentType="text/html; charset=GB18030"
  2     pageEncoding="GB18030"%>
  3 <%@include file="/share/taglib.jsp" %>
  4 <%
  5     String path = request.getContextPath();
  6     String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  7 %>
  8 <html>
  9 <head>
 10 <meta http-equiv="Content-Type" content="text/html; charset=GB18030">
 11 <link href="<%=basePath%>style/oa.css" rel="stylesheet" type="text/css">
 12 <script language="javascript" src="<%=basePath%>script/public.js"></script>
 13 <script type="text/javascript">
 14         //到指定的分页页面
 15     function topage(page){
 16         var form = document.forms[0];
 17         form.page.value=page;
 18         form.submit();
 19     }
 20 </script>
 21 <title>客户管理</title>
 22 </head>
 23 <BODY bgColor=#dee7ff leftMargin=0 background="" topMargin=0 marginheight="0" marginwidth="0">
 24 <center>
 25       <TABLE width="778" border=0 cellPadding=0 cellSpacing=0 borderColor=#ffffff bgColor=#dee7ff style="FONT-SIZE: 10pt">
 26         <TBODY>
 27           <TR height=35>
 28             <TD align=middle width=20 background=<%=basePath%>images/title_left.gif 
 29           bgColor=#dee7ff></TD>
 30             <TD align=middle width=120 background=<%=basePath%>images/title_left.gif 
 31           bgColor=#dee7ff><FONT color=#f7f7f7> 客户管理<font color="#FFFFFF">&nbsp;</font></FONT> </TD>
 32             <TD align=middle width=11 background=<%=basePath%>images/title_middle.gif 
 33           bgColor=#dee7ff><FONT color=#f7f7f7>&nbsp;</FONT> </TD>
 34             <TD align=middle background=<%=basePath%>images/title_right.gif 
 35           bgColor=#dee7ff><FONT color=#f7f7f7>&nbsp;</FONT> </TD>
 36           </TR>
 37         </TBODY>
 38       </TABLE>
 39       <TABLE width="778" border=0 align=center cellPadding=0 cellSpacing=0 borderColor=#ffffff style="FONT-SIZE: 10pt">
 40         <TBODY>
 41           <TR>
 42             <TD width="82%" height=14 align=right vAlign=center noWrap>
 43             </TD>
 44             <TD width="18%" align=right vAlign=center noWrap> </TD>
 45           </TR>
 46           <TR>
 47             <TD height=14 align=right vAlign=center noWrap>
 48                 <!-- 在这里插入查询表单 -->
 49             </TD>
 50             <TD height=14 align="left" vAlign=center noWrap>
 51             <a href="#" onclick="openWin('customermanage_addUI.do','addperson',600,200);">新增客户信息</a>
 52             </TD>
 53           </TR>
 54           <TR>
 55             <TD height=28 colspan="2" align=right vAlign=center noWrap background="<%=basePath%>images/list_middle.jpg">&nbsp;&nbsp;
 56             <!-- 可以在这里插入分页导航条 -->
 57             </TD>
 58           </TR>
 59         </TBODY>
 60       </TABLE>
 61       <form action="customer.do" method="post">
 62       <s:hidden name="page"/>
 63       <s:hidden name="customercode"/>
 64       <s:hidden name="customername"/>
 65       <s:hidden name="phone"/>
 66       <s:hidden name="address"/>
 67       <s:hidden name="relationman"/>
 68       <s:hidden name="other"/>
 69       <table width="778" border="0" cellPadding="0" cellSpacing="1" bgcolor="#6386d6">
 70           <!-- 列表标题栏 -->
 71           <tr bgcolor="#EFF3F7" class="TableBody1">
 72               <td width="10%" height="37" align="center"><b>客户编号</b></td>
 73               <td width="10%" height="37" align="center"><B>客户名称</B></td>
 74               <td width="18%" height="37" align="center"><b>联系电话</b></td>
 75               <td width="18%" height="37" align="center"><b>联系地址</b></td>
 76               <td width="18%" height="37" align="center"><b>联系人</b></td>
 77               <td width="18%" height="37" align="center"><b>其他信息</b></td>
 78               <td width="10%" height="37" align="center"><b>操作</b></td>
 79           </tr>
 80           <!-- 列表数据栏 -->
 81          <s:if test="null != #request.pageView.records && !#request.pageView.records.isEmpty() ">
 82           <s:iterator value="#request.pageView.records" id="entity"> 
 83           <tr bgcolor="#EFF3F7" class="TableBody1" onmouseover="this.bgColor = '#DEE7FF';" onmouseout="this.bgColor='#EFF3F7';">
 84               <td align="center" vAlign="center">${entity.customerNO }</td>
 85               <td align="center" vAlign="center">${entity.customerName }</td>
 86               <td align="center" vAlign="center">${entity.phone }</td>
 87               <td align="center" vAlign="center">${entity.address }</td>
 88               <td align="center" vAlign="center">${entity.relationman }</td>
 89               <td align="center" vAlign="center">${entity.otherInfo }</td>
 90               <td align="center" vAlign="center"><a href="#" onclick="del('customermanage_del.do?customerNO=${entity.customerNO}');">删除</a>
 91               <a href="#" onclick="openWin('customermanage_updateUI.do?customerNO=${entity.customerNO}','addperson',600,200);">修改</a>
 92               </td>
 93         </tr>
 94         </s:iterator>
 95         </s:if>
 96         <!-- 在列表数据为空的时候,要显示的提示信息 -->
 97         <s:else>
 98         <tr>
 99             <td colspan="7" align="center" bgcolor="#EFF3F7" class="TableBody1" onmouseover="this.bgColor = '#DEE7FF';" onmouseout="this.bgColor='#EFF3F7';">
100             没有找到相应的记录
101             </td>
102         </tr>
103         </s:else>
104       </table>
105       <TABLE width="778" border=0 align=center cellPadding=0 cellSpacing=0 borderColor=#ffffff style="FONT-SIZE: 10pt">
106         <TBODY>
107           <TR>
108             <TD height=28 align=right vAlign=center noWrap background="<%=basePath%>images/list_middle.jpg">&nbsp;&nbsp;
109             <!-- 可以在这里插入分页导航条 -->
110             <%@ include file="/share/fenye.jsp" %>
111             </TD>
112           </TR>
113         </TBODY>
114       </TABLE>
115       </form>
116 </center>
117 
118 </body>
119 
120 </html>

 

10.customer/customer_query.jsp

  1 <%@ page language="java" contentType="text/html; charset=GB18030"
  2     pageEncoding="GB18030"%>
  3 <%@include file="/share/taglib.jsp" %>
  4 <%
  5     String path = request.getContextPath();
  6     String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  7 %>
  8 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  9 <html>
 10 <head>
 11 <meta http-equiv="Content-Type" content="text/html; charset=GB18030">
 12 <link href="<%=basePath%>style/oa.css" rel="stylesheet" type="text/css">
 13 <script language="javascript" src="<%=basePath%>script/public.js"></script>
 14 <title>查询客户信息</title>
 15 </head>
 16 <body>
 17 <center>
 18 <form action="customer.do" method="post">
 19 <input type="hidden" name="query" value="true">
 20 <center>
 21 <TABLE width="778" border=0 cellPadding=0 cellSpacing=0 borderColor=#ffffff bgColor=#dee7ff style="FONT-SIZE: 10pt">
 22         <TBODY>
 23           <TR height=35>
 24             <TD align=middle width=20 background=<%=basePath%>images/title_left.gif 
 25           bgColor=#dee7ff></TD>
 26             <TD align=middle width=120 background=<%=basePath%>images/title_left.gif 
 27           bgColor=#dee7ff><FONT color=#f7f7f7>客户查询<font color="#FFFFFF">&nbsp;</font></FONT> </TD>
 28             <TD align=middle width=11 background=<%=basePath%>images/title_middle.gif 
 29           bgColor=#dee7ff><FONT color=#f7f7f7>&nbsp;</FONT> </TD>
 30             <TD align=middle background=<%=basePath%>images/title_right.gif 
 31           bgColor=#dee7ff><FONT color=#f7f7f7>&nbsp;</FONT> </TD>
 32           </TR>
 33         </TBODY>
 34       </TABLE>
 35 </center>
 36 <TABLE width="778" border=0 align=center cellPadding=0 cellSpacing=0 borderColor=#ffffff style="FONT-SIZE: 10pt">
 37         <TBODY>
 38           <TR>
 39             <TD width="82%" height=14 align=right vAlign=center noWrap>
 40             </TD>
 41             <TD width="18%" align=right vAlign=center noWrap> </TD>
 42           </TR>
 43           <TR>
 44             <TD height=14 align=right vAlign=center noWrap>
 45                 <!-- 在这里插入查询表单 -->
 46             </TD>
 47           </TR>
 48           <TR>
 49             <TD height=28 colspan="2" align=right vAlign=center noWrap background="<%=basePath%>images/list_middle.jpg">&nbsp;&nbsp;
 50             <!-- 可以在这里插入分页导航条 -->
 51             </TD>
 52           </TR>
 53         </TBODY>
 54       </TABLE>
 55 <TABLE class="tableEdit" border="0" cellspacing="1" cellpadding="0" style="width:580px;">
 56     <TBODY>
 57         <TR>
 58             <td>
 59             <!-- 主输入域开始 -->
 60 <table class="tableEdit" style="width:778px;" cellspacing="0" border="0" cellpadding="0">
 61     <tr>
 62         <td class="tdEditLabel" >客户编号</td>            
 63         <td class="tdEditContent"><input type="text" name="customerNO">
 64         </td>
 65     </tr>
 66     <tr>
 67         <td class="tdEditLabel" >客户名称</td>            
 68         <td class="tdEditContent"><input type="text" name="customerName"></td>
 69     </tr>
 70     <tr>
 71         <td class="tdEditLabel" >联系电话</td>            
 72         <td class="tdEditContent"><input type="text" name="phone">
 73         </td>
 74     </tr>
 75     <tr>
 76         <td class="tdEditLabel" >联系地址</td>            
 77         <td class="tdEditContent"><input type="text" name="address"></td>
 78     </tr>
 79     <tr>
 80         <td class="tdEditLabel" >联系人</td>            
 81         <td class="tdEditContent"><input type="text" name="relationman">
 82         </td>
 83     </tr>
 84     <tr>
 85         <td class="tdEditLabel" >其他信息</td>            
 86         <td class="tdEditContent"><input type="text" name="otherInfo"></td>
 87     </tr>
 88 </table>
 89             <!-- 主输入域结束 -->
 90             </td>
 91         </TR>
 92     </TBODY>
 93 </TABLE>
 94 
 95 <TABLE>
 96         <TR align="center">
 97             <TD colspan="3" bgcolor="#EFF3F7">
 98             <input type="submit" name="saveButton"
 99                 class="MyButton" value="查询客户信息"> 
100             </TD>
101         </TR>
102 </TABLE>
103 <TABLE width="778" border=0 align=center cellPadding=0 cellSpacing=0 borderColor=#ffffff style="FONT-SIZE: 10pt">
104         <TBODY>
105           <TR>
106             <TD height=28 align=right vAlign=center noWrap background="<%=basePath%>images/list_middle.jpg">&nbsp;&nbsp;
107             </TD>
108           </TR>
109         </TBODY>
110 </TABLE>
111 </form>
112 </center>
113 </body>
114 </html>

 

11.customer/customer_update.jsp

 1 <%@ page language="java" contentType="text/html; charset=GB18030"
 2     pageEncoding="GB18030"%>
 3 <%@include file="/share/taglib.jsp" %>
 4 <%
 5     String path = request.getContextPath();
 6     String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 7 %>
 8 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 9 <html>
10 <head>
11 <meta http-equiv="Content-Type" content="text/html; charset=GB18030">
12 <link href="<%=basePath%>style/oa.css" rel="stylesheet" type="text/css">
13 <script language="javascript" src="<%=basePath%>script/public.js"></script>
14 <title>更新客户信息</title>
15 </head>
16 <body>
17 <center>
18 <form action="customermanage_update.do" method="post">
19 <input type="hidden" name="customerNO" value="${customer.customerNO}">
20 <TABLE class="tableEdit" border="0" cellspacing="1" cellpadding="0" style="width:580px;">
21     <TBODY>
22         <TR>
23             <!-- 这里是添加、编辑界面的标题 -->
24             <td align="center" class="tdEditTitle">更新客户信息</TD>
25         </TR>
26         <TR>
27             <td>
28             <!-- 主输入域开始 -->
29 <table class="tableEdit" style="width:580px;" cellspacing="0" border="0" cellpadding="0">
30     <tr>
31         <td class="tdEditLabel" >客户名称</td>            
32         <td class="tdEditContent"><input type="text" name="customerName" value="${customer.customerName}"></td>
33         <td class="tdEditLabel" >联系电话</td>            
34         <td class="tdEditContent"><input type="text" name="phone" value="${customer.phone}">
35         </td>
36     </tr>
37     <tr>
38         <td class="tdEditLabel" >联系地址</td>            
39         <td class="tdEditContent"><input type="text" name="address" value="${customer.address}"></td>
40         <td class="tdEditLabel" >联系人</td>            
41         <td class="tdEditContent"><input type="text" name="relationman" value="${customer.relationman}">
42         </td>
43     </tr>
44     <tr>
45         <td class="tdEditLabel" >其他</td>            
46         <td class="tdEditContent" colspan="3"><input type="text" name="otherInfo" value="${customer.otherInfo}"></td>
47     </tr>
48 </table>
49             <!-- 主输入域结束 -->
50             </td>
51         </TR>
52     </TBODY>
53 </TABLE>
54 
55 <TABLE>
56         <TR align="center">
57             <TD colspan="3" bgcolor="#EFF3F7">
58             <input type="submit" name="saveButton"
59                 class="MyButton" value="更新客户信息"> 
60             <input type="button" class="MyButton"
61                 value="关闭窗口" onclick="window.close()">
62             </TD>
63         </TR>
64 </TABLE>
65 </form>
66 </center>
67 </body>
68 </html>

 

12.

posted @ 2016-03-28 11:34  shamgod  阅读(2011)  评论(0编辑  收藏  举报
haha