Horizontal layout test (CSS) of the formpanel panel and Form Control in CSS ext)

Source: Internet
Author: User
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> horizontal layout test (CSS) of the formpanel panel and Form Control in ext </title>
<LINK rel = "stylesheet" type = "text/CSS" Media = "all" href = "../EXT/resources/CSS/ext-all.css"/>
<Style type = "text/CSS" Media = "all">
. Allow-float {clear: none! Important;}/* allow this element to float */
. Stop-float {clear: both! Important;}/* prevents this element from floating */
. Sex-male {float: Left ;}
. Sex-female {float: Left; padding: 0 0 0 20px ;}
. Age-field {float: Left; padding: 0 0 58px; * padding: 0 0 0 50px! Important; * padding: 0 0 0 50px ;}
</Style>
</Head>
<Body>
<SCRIPT type = "text/JavaScript" src = "../EXT/adapter/EXT/ext-base.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "../EXT/ext-all.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "../EXT/build/locale/ext-lang-zh_CN.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript"> Ext. blank_image_url = '../EXT/resources/images/default/s.gif'; </SCRIPT>
<SCRIPT type = "text/JavaScript">
Ext. onready (function (){
// Create a form panel
VaR fp = new Ext. Form. formpanel ({
Buttonalign: 'center ',
Labelalign: 'right ',
Labelwidth: 40,
Frame: True,
Bodystyle: 'padding: 8px 0 0 0 ;',
Items :[{
Xtype: 'textfield ',
Fieldlabel: 'name ',
Name: 'n' _ Username ',
ID: 'I _ username ',
Width: 320
},{
Xtype: 'Radio ',
Fieldlabel: 'gender ',
Boxlabel: 'male ',
Name: 'sex ',
ID: 'male ',
Itemcls: 'sex-Male', // float to the left to handle horizontal control la s
Clearcls: 'Allow-float', // The two sides are allowed to float. The actually generated HTML structure contains a special Div to block the float.
Checked: True
},{
Xtype: 'Radio ',
Boxlabel: 'femal ',
Name: 'sex ',
ID: 'female ',
Itemcls: 'sex-female ', // float to the left to process the horizontal control
Clearcls: 'Allow-float', // allow floating on both sides
Hidelabel: True // The preceding "gender" label is not displayed.
},{
Xtype: 'textfield ',
Fieldlabel: 'age ',
Name: 'n' _ age ',
ID: 'I _ age ',
Itemcls: 'Age-field ', // float to the left to handle horizontal control la s
Width: 133
},{
Xtype: 'textfield ',
Fieldlabel: 'address ',
Name: 'n' _ address ',
ID: 'I _ address ',
Itemcls: 'Stop-float ', // float is not allowed.
Width: 320
}],
Buttons :[{
Text: 'OK ',
Handler: onok // the actual application is generally to process the FP. getform. Submit () event.
},{
Text: 'reset ',
Handler: function () {FP. getform (). Reset ();}
}],
Keys: [{// handle keyboard carriage return events
Key: Ext. eventobject. Enter,
FN: onok,
Scope: This
}]
});

// Confirm the button event. Here, we just get the values of each control. The actual application is generally combined with the background script.
Function onok (){
VaR strmsg;
Strmsg = 'name: '+ FP. getcomponent (' I _ username'). getvalue () + ', Gender :';
If (FP. getcomponent ('male'). Checked) strmsg + = 'male ';
If (FP. getcomponent ('female'). Checked) strmsg + = 'femal ';
Strmsg + = ', age:' + FP. getcomponent ('I _ age'). getvalue ();
Strmsg + = ', address:' + FP. getcomponent ('I _ address'). getvalue ();
Alert (strmsg );
}

// Create the Main Window
New Ext. Window ({
Title: 'ext formpanel panel and Form Control horizontal layout test (CSS )',
Width: 400,
Closable: false,
Collapsible: True,
Draggable: false,
Resizable: false,
Modal: True,
Border: false,
Items: [FP],
Buttons: []
}). Show ();
});
</SCRIPT>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.