<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Thinking

    快樂編程,開心生活
    posts - 21, comments - 27, trackbacks - 0, articles - -5
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    2007年4月27日

    CCP Review-Javascript
    1、對于div中的input標簽,如果div的style.display屬性為'none',那么調用input標簽的focus方法在IE6.0上會報錯,首先應該讓其display屬性為''或者'block'再調用;
    2、當HTML元素的name屬性唯一時可以利用document.getElementById()調用獲得這個元素;
    3、如果異步提交耗時較長,可在異步提交之前顯示等待提示,在回調函數中根據返回值更新提示;
    4、在JS中function也是可以作為變量的,所以我們可以在自己封裝的框架中預留回調函數供自定義使用,如下面的代碼:
     1 //common.js
     2 var callback = null;
     3 function commonUse(){
     4   
     5   if(typeof(callback) == "function"){
     6     callback();
     7   }
     8   
     9 }
    10 
    11 //self.js
    12 function selfUse(){
    13   
    14   callback = function(){
    15     //do something before
    16   }
    17   commonUse();
    18   
    19 }

    5、JS中可以使用正則表達式來校驗數字域、日期域和EMail等。代碼示例如下:
    校驗日期的例子:
     1     function isDate(date){
     2         //對日期格式進行驗證 要求為2000-2099年  格式為 yyyy-mm-dd 并且可以正常轉換成正確的日期
     3         var regex=/^(19|20)\d{2}-((0[1-9]{1})|(1[0-2]{1}))-((0[1-9]{1})|([1-2]{1}[0-9]{1})|(3[0-1]{1}))$/;
     4         
     5         if(!regex.test(date)){
     6             return false;
     7         }
     8         var arr_=date.split("-");
     9         var tmp = new Date(arr_[0], parseFloat(arr_[1])-1, parseFloat(arr_[2]));
    10         if(tmp.getFullYear()!=parseFloat(arr_[0]) 
    11             || tmp.getMonth()!=parseFloat(arr_[1])-1 
    12             || tmp.getDate()!=parseFloat(arr_[2])){
    13             return false;
    14         }
    15          
    16          return true;
    17     }
      這篇文章有詳細的說明:http://www.tkk7.com/byterat/archive/2006/12/20/89143.html
      這本電子書是講解正則表達式的:http://www.tkk7.com/Files/kawaii/RegularExpressions.zip 
    6、在JS編碼中,如果代碼量較大,要注意防止function名稱重復,包括直接在頁面上編寫的和引用外部JS文件的,不然會出現一些莫名奇妙的問題;
    7、注意JS代碼中的函數返回語句return的使用;
    8、盡量把JS代碼寫在外部公共的文件中,而在頁面中引入,好處有:a.函數復用;b.JS文件緩存;c.提供頁面解析速度。基于b,我們在修改JS代碼后,要看IE的設置是否將原先的JS文件緩存造成問題;
    9、對于同一個頁面的多個表單提交,我們可以在第一個表單中設置相應的隱藏域,在表單提交之前利用JS腳本把其他表單的數據設置到第一個表單的隱藏域中;
    10、對于異步校驗的文本框,我們一般設置觸發事件為onblur而不是onchange或者onpropertychange,以減少客戶端和服務器的交互次數,但應該注意如果這個文本框最初沒有獲得焦點,那么onblur就不會觸發,可以先調用以下onfocus,再調用onblur手動觸發;
    11、JS中不存在trim()函數,自定義如下:
     1 //JS去除首尾空格(同VBS的Trim)
     2     function trim(inputString) {   
     3         if (typeof inputString != "string") {
     4             return inputString; 
     5         }
     6         var retValue = inputString;
     7         var ch = retValue.substring(01);
     8         while (ch == " ") {
     9                //檢查字符串開始部分的空格
    10             retValue = retValue.substring(1, retValue.length);
    11             ch = retValue.substring(01);
    12         }
    13         ch = retValue.substring(retValue.length-1, retValue.length);
    14         while (ch == " ") {
    15             //檢查字符串結束部分的空格
    16             retValue = retValue.substring(0, retValue.length-1);
    17             ch = retValue.substring(retValue.length-1, retValue.length);
    18         }
    19         while (retValue.indexOf("  "!= -1) {
    20             //將文字中間多個相連的空格變為一個空格
    21             retValue = retValue.substring(0, retValue.indexOf("  ")) 
    22                 + retValue.substring(retValue.indexOf("  ")+1, retValue.length);
    23         }
    24         return retValue;
    25     }
    12、JS中顯示模式窗口,代碼如下:
     1 function showMyDialog(){
     2   var dialogProperty = 'dialogWidth:800px;dialogHeight:600px;status:no';
     3   var windowProperty = "height=800,width=800,status=no,toolbar=no,menubar=yes,location=yes,resizable=yes,scrollbars=yes";
     4 
     5   var url = "SomeAction.do?id="+id+"&flag=true";
     6   var returnVal = window.showModalDialog(url,"", dialogProperty);
     7   if(typeof(returnVal) == "undefined"){
     8     return;
     9   }
    10   if(returnVal !=  ""){
    11     //do something   
    12   }
    13 }
    14 
    在新打開的模式窗口中,我們通過window.returnValue設置返回值,然后在父頁面中我們通過returnVal可以拿到返回值。

    posted @ 2007-11-27 23:41 lixw 閱讀(280) | 評論 (0)編輯 收藏

      1. 啟動數據庫   
      db2start   
      2. 停止數據庫   
      db2stop   
      3. 連接數據庫   
      db2   connect   to   o_yd   user   db2   using   pwd   
      4. 讀數據庫管理程序配置   
      db2   get   dbm   cfg   
      5. 寫數據庫管理程序配置   
      db2   update   dbm   cfg   using   參數名   參數值   
      6. 讀數據庫的配置   
      db2   connect   to   o_yd   user   db2   using   pwd   
      db2   get   db   cfg   for   o_yd   
      7. 寫數據庫的配置   
      db2   connect   to   o_yd   user   db2   using   pwd   
      db2   update   db   cfg   for   o_yd   using   參數名   參數值   
      8. 關閉所有應用連接   
      db2   force   application   all   
      db2   force   application   ID1,ID2,,,Idn   MODE   ASYNC   
      (db2   list   application   for   db   o_yd   show   detail)   
      9. 備份數據庫   
      db2   force   application   all   
      db2   backup   db   o_yd   to   d:   
      (db2   initialize   tape   on   \\.\tape0)   
      (db2   rewind   tape   on   \\.\tape0)   
      db2   backup   db   o_yd   to   \\.\tape0   
      10. 恢復數據庫   
      db2   restore   db   o_yd   from   d:   to   d:     
      db2   restore   db   o_yd   from   \\.\tape0   to   d:   
      11. 綁定存儲過程   
      db2   connect   to   o_yd   user   db2   using   pwd   
      db2   bind   c:\dfplus.bnd   
      拷貝存儲過程到服務器上的C:\sqllib\function目錄中   
      12. 整理表   
      db2   connect   to   o_yd   user   db2   using   pwd   
      db2   reorg   table   ydd   
      db2   runstats   on   table   ydd   with   distribution   and   indexes   all     
      13. 導出表數據  
      db2   export   to   c:\sw.txt   of   del   select   *   from   dftz  
      db2   export   to   c:\sw.ixf   of   ixf   select   *   from   dftz  
      14. 導入表數據  
      db2   import   from   c:\sw.txt   of   del   insert   into   ylbx.czyxx  
      db2   import   to   c:\sw.txt   of   del   commitcount   5000   messages       c:\dftz.msg   insert   into   dftz  
      db2   import   to   c:\dftz.ixf   of   ixf   commitcount   5000   messages   c:\dftz.msg   insert   into   dftz  
      db2   import   to   c:\dftz.ixf   of   ixf   commitcount   5000   insert   into   dftz  
      db2   import   to   c:\dftz.ixf   of   ixf   commitcount   5000   insert_update   into   dftz  
      db2   import   to   c:\dftz.ixf   of   ixf   commitcount   5000   replace   into   dftz  
      db2   import   to   c:\dftz.ixf   of   ixf   commitcount   5000   create   into   dftz       (僅IXF)  
      db2   import   to   c:\dftz.ixf   of   ixf   commitcount   5000   replace_create   into   dftz     (僅IXF)  
      15. 執行一個批處理文件  
      db2   –tf   批處理文件名  
      (文件中每一條命令用   ;結束)  
      16. 自動生成批處理文件  
      建文本文件:temp.sql  
      select   'runstats   on   table   DB2.'   ||   tabname   ||   '   with   distribution   and   detailed   indexes   all;'   from   syscat.tables   where   tabschema='DB2'   and   type='T';
      db2   –tf   temp.sql>runstats.sql  
      17. 自動生成建表(視圖)語句  
      在服務器上:C:\sqllib\misc目錄中  
      db2   connect   to   o_yd   user   db2   using   pwd  
      db2look   –d   o_yd   –u   db2   –e   –p   –c   c:\o_yd.txt     
      db2look   -d   lys   -e   -a   -x   -i   db2admin   -o   c:\aa.txt  
      18. 其他命令  
      grant   dbadm   on   database   to   user   bb   
      19.    select   *   from   czyxx   fetch   first   1   rows   only  
      20.    db2look   –d   lys   –u   db2admin   –w   –asd   –a   –e   –o   c:\mytable.txt   

    posted @ 2007-04-27 08:54 lixw 閱讀(263) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 亚洲AV成人一区二区三区在线看| 亚洲av福利无码无一区二区| 亚洲一欧洲中文字幕在线| 日韩精品久久久久久免费| 久久精品亚洲综合| 免费A级毛片无码A∨中文字幕下载| 在线a亚洲v天堂网2019无码| 成人免费一区二区三区| 亚洲AV无码一区二区二三区入口 | 久久精品亚洲综合一品| 久9这里精品免费视频| 久久亚洲国产精品五月天| 在线观看www日本免费网站| 亚洲w码欧洲s码免费| 啦啦啦www免费视频| 美女一级毛片免费观看| 在线亚洲97se亚洲综合在线 | 亚洲依依成人亚洲社区| 麻豆成人精品国产免费| 手机永久免费的AV在线电影网| 在线亚洲午夜理论AV大片| 十八禁无码免费网站| 亚洲精品123区在线观看| 免费A级毛片在线播放不收费| 中文在线免费不卡视频| 亚洲第一页在线观看| 日韩成人免费在线| 亚洲天堂免费在线视频| 亚洲综合在线成人一区| 国产成人无码区免费A∨视频网站| 国产精品免费一区二区三区| 内射少妇36P亚洲区| 免费日韩在线视频| 久久久久久久99精品免费观看| 亚洲av成人一区二区三区| 免费人成视频在线观看视频 | 女人被男人躁的女爽免费视频| 深夜特黄a级毛片免费播放| 亚洲AV无码久久精品狠狠爱浪潮| 无码日韩精品一区二区免费| 国产黄片不卡免费|