当前位置:编程学习 > JS >>

EXTJs 表单控件

<1>TextField 文本输入控件


[javascript]
<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    <title>Ext Buttons</title> 
    <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css"/> 
    <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script> 
    <script type="text/javascript" src="../../ext-all.js"></script> 
    <script type="text/javascript" src="../examples.js"></script> 
    <script type="text/javascript"> 
        Ext.onReady(function(){ 
            //Ext.form.TextField  
            var textField = new Ext.form.TextField( 
                { 
                    fieldLabel:'用户名', 
                    allowBlank:false,//不允许为空  
                    emptyText:'请填写用户名',//输入为空时提示的默认信息  
                    maxLength:10,//限制输入的数据在5-10之间  
                    minLength:5, 
                } 
            ); 
            //Ext.form.FormPanel  
            var form = new Ext.form.FormPanel( 
                { 
                    title:'表单控件', 
                    frame:true, 
                    items:[textField], 
                    renderTo:'form' 
                } 
            ); 
        } 
    ); 
    </script> 
</head> 
<body> 
    <div id = "form" style = "width:700px;"> 
    </div> 
    <br> 
</body> 
</html> 

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>Ext Buttons</title>
    <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css"/>
    <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="../../ext-all.js"></script>
    <script type="text/javascript" src="../examples.js"></script>
 <script type="text/javascript">
  Ext.onReady(function(){
   //Ext.form.TextField
   var textField = new Ext.form.TextField(
    {
     fieldLabel:'用户名',
     allowBlank:false,//不允许为空
     emptyText:'请填写用户名',//输入为空时提示的默认信息
     maxLength:10,//限制输入的数据在5-10之间
     minLength:5,
    }
   );
   //Ext.form.FormPanel
   var form = new Ext.form.FormPanel(
    {
     title:'表单控件',
     frame:true,
     items:[textField],
     renderTo:'form'
    }
   );
  }
 );
 </script>
</head>
<body>
 <div id = "form" style = "width:700px;">
 </div>
 <br>
</body>
</html>

 


<2>TextArea多行文本输入控件


[javascript]
/Ext.form.TextArea  
            var textArea = new Ext.form.TextArea( 
                { 
                    width:200,//宽度  
                    grow:true,//当值为 true 时表示字段可以根据内容自动伸缩  
                    preventScrollbars:true,//防止出现滚动条,如果超出会自动隐藏  
                    fieldLabel:'自我介绍', 
                    allowBlank:false,//不允许为空  
                    emptyText:'空',//输入为空时提示的默认信息  
                    maxLength:100,//限制输入的数据在10-100之间  
                    minLength:10, 
                } 
            ); 
            //Ext.form.FormPanel  
       &n

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,