乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      無廢話ExtJs[單選組:RadioGroup、復選組:CheckBoxGroup]

       yan的圖書41 2014-04-25
      1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www./TR/xhtml1/DTD/xhtml1-transitional.dtd">  
      2.  <html xmlns="http://www./1999/xhtml">  
      3.  <head>  
      4.      <title></title>  
      5.      <!--ExtJs框架開始-->  
      6.      <script type="text/javascript" src="/Ext/adapter/ext/ext-base.js"></script>  
      7.      <script type="text/javascript" src="/Ext/ext-all.js"></script>  
      8.      <script src="/Ext/src/locale/ext-lang-zh_CN.js" type="text/javascript"></script>  
      9.      <link rel="stylesheet" type="text/css" href="/Ext/resources/css/ext-all.css" />  
      10.      <!--ExtJs框架結(jié)束-->  
      11.      <style type="text/css">  
      12.          .x-form-unit  
      13.          {  
      14.              height: 22px;  
      15.              line-height: 22px;  
      16.              padding-left: 2px;  
      17.              display: inline-block;  
      18.              display: inline;  
      19.          }  
      20.      </style>  
      21.      <script type="text/javascript">  
      22.    
      23.          Ext.override(Ext.form.TextField, {  
      24.              unitText: '',  
      25.              onRender: function (ct, position) {  
      26.                  Ext.form.TextField.superclass.onRender.call(this, ct, position);  
      27.                  // 如果單位字符串已定義 則在后方增加單位對象     
      28.                  if (this.unitText != '') {  
      29.                      this.unitEl = ct.createChild({  
      30.                          tag: 'div',  
      31.                          html: this.unitText  
      32.                      });  
      33.                      this.unitEl.addClass('x-form-unit');  
      34.                      // 增加單位名稱的同時 按單位名稱大小減少文本框的長度 初步考慮了中英文混排 未考慮為負的情況     
      35.                      this.width = this.width - (this.unitText.replace(/[^\x00-\xff]/g, "xx").length * 6 + 2);  
      36.                      // 同時修改錯誤提示圖標的位置     
      37.                      this.alignErrorIcon = function () {  
      38.                          this.errorIcon.alignTo(this.unitEl, 'tl-tr', [2, 0]);  
      39.                      };  
      40.                  }  
      41.              }  
      42.          });  
      43.    
      44.          Ext.onReady(function () {  
      45.              //初始化標簽中的Ext:Qtip屬性。  
      46.              Ext.QuickTips.init();  
      47.              Ext.form.Field.prototype.msgTarget = 'side';  
      48.    
      49.              //提交按鈕處理方法  
      50.              var btnsubmitclick = function () {  
      51.                  Ext.MessageBox.alert('提示', '你點了確定按鈕!');  
      52.              }  
      53.              //重置按鈕"點擊時"處理方法  
      54.              var btnresetclick = function () {  
      55.                  Ext.MessageBox.alert('提示', '你點了重置按鈕!');  
      56.              }  
      57.              //重置按鈕"鼠標懸停"處理方法  
      58.              var btnresetmouseover = function () {  
      59.                  Ext.MessageBox.alert('提示', '你鼠標懸停在重置按鈕之上!');  
      60.              }  
      61.              //提交按鈕  
      62.              var btnsubmit = new Ext.Button({  
      63.                  text: '提交',  
      64.                  handler: btnsubmitclick  
      65.              });  
      66.              //重置按鈕  
      67.              var btnreset = new Ext.Button({  
      68.                  text: '重置',  
      69.                  listeners: {  
      70.                      'mouseover': btnresetmouseover,  
      71.                      'click': btnresetclick  
      72.                  }  
      73.              });  
      74.              //用戶名input  
      75.              var txtusername = new Ext.form.TextField({  
      76.                  width: 140,  
      77.                  allowBlank: false,  
      78.                  maxLength: 20,  
      79.                  name: 'username',  
      80.                  fieldLabel: '用戶名稱',  
      81.                  blankText: '請輸入用戶名',  
      82.                  maxLengthText: '用戶名不能超過20個字符'  
      83.              });  
      84.              //密碼input  
      85.              var txtpassword = new Ext.form.TextField({  
      86.                  width: 140,  
      87.                  allowBlank: false,  
      88.                  maxLength: 20,  
      89.                  inputType: 'password',  
      90.                  name: 'password',  
      91.                  fieldLabel: '密碼',  
      92.                  blankText: '請輸入密碼',  
      93.                  maxLengthText: '密碼不能超過20個字符'  
      94.              });  
      95.              var numberfield = new Ext.form.NumberField({  
      96.                  fieldLabel: '身高',  
      97.                  width: 80,  
      98.                  decimalPrecision: 1,  
      99.                  minValue: 0.01,  
      100.                  maxValue: 200,  
      101.                  unitText: ' cm',  
      102.                  allowBlank: false,  
      103.                  blankText: '請輸入身高'  
      104.              });  
      105.    
      106.              var hiddenfield = new Ext.form.Hidden({  
      107.                  name: 'userid',  
      108.                  value: '1'  
      109.              });  
      110.    
      111.              var datefield = new Ext.form.DateField({  
      112.                  fieldLabel: '出生日期',  
      113.                  format: 'Y-m-d',  
      114.                  editable: false,  
      115.                  allowBlank: false,  
      116.                  blankText: '請選擇日期'  
      117.              });  
      118.              //----------------------單選組開始----------------------//  
      119.              var radiogroup = new Ext.form.RadioGroup({  
      120.                  fieldLabel: '性別',  
      121.                  width: 100,  
      122.                  items: [{  
      123.                      name: 'sex',  
      124.                      inputValue: '0',  
      125.                      boxLabel: '男',  
      126.                      checked: true  
      127.                  }, {  
      128.                      name: 'sex',  
      129.                      inputValue: '1',  
      130.                      boxLabel: '女'  
      131.                  }]  
      132.              });  
      133.              //獲取單選組的值  
      134.              radiogroup.on('change', function (rdgroup, checked) {  
      135.                  alert(checked.getRawValue());  
      136.              });  
      137.              //----------------------單選組結(jié)束----------------------//  
      138.              //----------------------復選組開始----------------------//  
      139.              var checkboxgroup = new Ext.form.CheckboxGroup({  
      140.                  fieldLabel: '興趣愛好',  
      141.                  width: 170,  
      142.                  items: [{  
      143.                      boxLabel: '看書',  
      144.                      inputValue: '0'  
      145.                  }, {  
      146.                      boxLabel: '上網(wǎng)',  
      147.                      inputValue: '1'  
      148.                  }, {  
      149.                      boxLabel: '聽音樂',  
      150.                      inputValue: '2'  
      151.                  }]  
      152.              });  
      153.              //獲取復選組的值  
      154.              checkboxgroup.on('change', function (cbgroup, checked) {  
      155.                  for (var i = 0; i < checked.length; i++) {  
      156.                      alert(checked[i].getRawValue());  
      157.                  }  
      158.              });  
      159.              //----------------------復選組結(jié)束----------------------//  
      160.              //表單  
      161.              var form = new Ext.form.FormPanel({  
      162.                  frame: true,  
      163.                  title: '表單標題',  
      164.                  style: 'margin:10px',  
      165.                  html: '<div style="padding:10px">這里表單內(nèi)容</div>',  
      166.                  items: [txtusername, txtpassword, numberfield, hiddenfield, datefield, radiogroup, checkboxgroup],  
      167.                  buttons: [btnsubmit, btnreset]  
      168.              });  
      169.              //窗體  
      170.              var win = new Ext.Window({  
      171.                  title: '窗口',  
      172.                  width: 476,  
      173.                  height: 374,  
      174.                  html: '<div>這里是窗體內(nèi)容</div>',  
      175.                  resizable: true,  
      176.                  modal: true,  
      177.                  closable: true,  
      178.                  maximizable: true,  
      179.                  minimizable: true,  
      180.                  buttonAlign: 'center',  
      181.                  items: form  
      182.              });  
      183.              win.show();  
      184.          });  
      185.      </script>  
      186.  </head>  
      187.  <body>  
      188.      <!--  
      189.  說明:  
      190.  (1)var radiogroup = new Ext.form.RadioGroup():創(chuàng)建一個新的單選按鈕組。  
      191.  (2)name: 'sex':單選按鈕組是按照 name 屬性來區(qū)分的,同一組中的單選按鈕才能單選,  
      192.          如果name屬性設置錯誤,該按鈕將會被認為是其他組。  
      193.  (3)inputValue: '0':選擇框的值。  
      194.  (4)boxLabel: '男':選擇框后面的文字說明。  
      195.  (5)checked.getRawValue():獲取選擇框的選中值,由于單選框只有一個選中值,可以直接獲取,  
      196.          而復選框可以多選,所以要循環(huán)取出。  
      197.  -->  
      198.  </body>  
      199.  </html>  

      <html xmlns="http://www./1999/xhtml">
      <head>
           <title></title>
           <!--ExtJs框架開始-->
           <script type="text/javascript" src="/Ext/adapter/ext/ext-base.js"></script>
           <script type="text/javascript" src="/Ext/ext-all.js"></script>
           <script src="/Ext/src/locale/ext-lang-zh_CN.js" type="text/javascript"></script>
           <link rel="stylesheet" type="text/css" href="/Ext/resources/css/ext-all.css" />
           <!--ExtJs框架結(jié)束-->
           <style type="text/css">
               .x-form-unit
               {
                   height: 22px;
                   line-height: 22px;
                   padding-left: 2px;
                   display: inline-block;
                   display: inline;
               }
           </style>
           <script type="text/javascript">

               Ext.override(Ext.form.TextField, {
                   unitText: '',
                   onRender: function (ct, position) {
                       Ext.form.TextField.superclass.onRender.call(this, ct, position);
                       // 如果單位字符串已定義 則在后方增加單位對象  
                       if (this.unitText != '') {
                           this.unitEl = ct.createChild({
                               tag: 'div',
                               html: this.unitText
                           });
                           this.unitEl.addClass('x-form-unit');
                           // 增加單位名稱的同時 按單位名稱大小減少文本框的長度 初步考慮了中英文混排 未考慮為負的情況  
                           this.width = this.width - (this.unitText.replace(/[^\x00-\xff]/g, "xx").length * 6 + 2);
                           // 同時修改錯誤提示圖標的位置  
                           this.alignErrorIcon = function () {
                               this.errorIcon.alignTo(this.unitEl, 'tl-tr', [2, 0]);
                           };
                       }
                   }
               });

               Ext.onReady(function () {
                   //初始化標簽中的Ext:Qtip屬性。
                   Ext.QuickTips.init();
                   Ext.form.Field.prototype.msgTarget = 'side';

                   //提交按鈕處理方法
                   var btnsubmitclick = function () {
                       Ext.MessageBox.alert('提示', '你點了確定按鈕!');
                   }
                   //重置按鈕"點擊時"處理方法
                   var btnresetclick = function () {
                       Ext.MessageBox.alert('提示', '你點了重置按鈕!');
                   }
                   //重置按鈕"鼠標懸停"處理方法
                   var btnresetmouseover = function () {
                       Ext.MessageBox.alert('提示', '你鼠標懸停在重置按鈕之上!');
                   }
                   //提交按鈕
                   var btnsubmit = new Ext.Button({
                       text: '提交',
                       handler: btnsubmitclick
                   });
                   //重置按鈕
                   var btnreset = new Ext.Button({
                       text: '重置',
                       listeners: {
                           'mouseover': btnresetmouseover,
                           'click': btnresetclick
                       }
                   });
                   //用戶名input
                   var txtusername = new Ext.form.TextField({
                       width: 140,
                       allowBlank: false,
                       maxLength: 20,
                       name: 'username',
                       fieldLabel: '用戶名稱',
                       blankText: '請輸入用戶名',
                       maxLengthText: '用戶名不能超過20個字符'
                   });
                   //密碼input
                   var txtpassword = new Ext.form.TextField({
                       width: 140,
                       allowBlank: false,
                       maxLength: 20,
                       inputType: 'password',
                       name: 'password',
                       fieldLabel: '密碼',
                       blankText: '請輸入密碼',
                       maxLengthText: '密碼不能超過20個字符'
                   });
                   var numberfield = new Ext.form.NumberField({
                       fieldLabel: '身高',
                       width: 80,
                       decimalPrecision: 1,
                       minValue: 0.01,
                       maxValue: 200,
                       unitText: ' cm',
                       allowBlank: false,
                       blankText: '請輸入身高'
                   });

                   var hiddenfield = new Ext.form.Hidden({
                       name: 'userid',
                       value: '1'
                   });

                   var datefield = new Ext.form.DateField({
                       fieldLabel: '出生日期',
                       format: 'Y-m-d',
                       editable: false,
                       allowBlank: false,
                       blankText: '請選擇日期'
                   });
                   //----------------------單選組開始----------------------//
                   var radiogroup = new Ext.form.RadioGroup({
                       fieldLabel: '性別',
                       width: 100,
                       items: [{
                           name: 'sex',
                           inputValue: '0',
                           boxLabel: '男',
                           checked: true
                       }, {
                           name: 'sex',
                           inputValue: '1',
                           boxLabel: '女'
                       }]
                   });
                   //獲取單選組的值
                   radiogroup.on('change', function (rdgroup, checked) {
                       alert(checked.getRawValue());
                   });
                   //----------------------單選組結(jié)束----------------------//
                   //----------------------復選組開始----------------------//
                   var checkboxgroup = new Ext.form.CheckboxGroup({
                       fieldLabel: '興趣愛好',
                       width: 170,
                       items: [{
                           boxLabel: '看書',
                           inputValue: '0'
                       }, {
                           boxLabel: '上網(wǎng)',
                           inputValue: '1'
                       }, {
                           boxLabel: '聽音樂',
                           inputValue: '2'
                       }]
                   });
                   //獲取復選組的值
                   checkboxgroup.on('change', function (cbgroup, checked) {
                       for (var i = 0; i < checked.length; i++) {
                           alert(checked[i].getRawValue());
                       }
                   });
                   //----------------------復選組結(jié)束----------------------//
                   //表單
                   var form = new Ext.form.FormPanel({
                       frame: true,
                       title: '表單標題',
                       style: 'margin:10px',
                       html: '<div style="padding:10px">這里表單內(nèi)容</div>',
                       items: [txtusername, txtpassword, numberfield, hiddenfield, datefield, radiogroup, checkboxgroup],
                       buttons: [btnsubmit, btnreset]
                   });
                   //窗體
                   var win = new Ext.Window({
                       title: '窗口',
                       width: 476,
                       height: 374,
                       html: '<div>這里是窗體內(nèi)容</div>',
                       resizable: true,
                       modal: true,
                       closable: true,
                       maximizable: true,
                       minimizable: true,
                       buttonAlign: 'center',
                       items: form
                   });
                   win.show();
               });
           </script>
      </head>
      <body>
           <!--
      說明:
      (1)var radiogroup = new Ext.form.RadioGroup():創(chuàng)建一個新的單選按鈕組。
      (2)name: 'sex':單選按鈕組是按照 name 屬性來區(qū)分的,同一組中的單選按鈕才能單選,
               如果name屬性設置錯誤,該按鈕將會被認為是其他組。
      (3)inputValue: '0':選擇框的值。
      (4)boxLabel: '男':選擇框后面的文字說明。
      (5)checked.getRawValue():獲取選擇框的選中值,由于單選框只有一個選中值,可以直接獲取,
               而復選框可以多選,所以要循環(huán)取出。
      -->
      </body>
      </html>
      2.效果如下:

        本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約