87,904
社区成员
发帖
与我相关
我的任务
分享
Ext.onReady(function(){
var p = new Ext.Panel({
title: 'My Panel',
collapsible:true,
renderTo: 'tt',
width:400,
height: 300,
items:[
{
x: 100,
y: 0,
xtype: 'textarea',
name: 'msg',
enableKeyEvents: true,
height:'100%',
width:'100%',
listeners: {
keyup: function(src, evt){
alert(src.getValue());
}
}
}
]
});
});
<html>
<head>
<title>Textarea</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css"/>
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript" src="textarea.js"></script>
<link rel="stylesheet" type="text/css" href="forms.css"/>
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="../shared/examples.css"/>
</head>
<body>
<div id="tt"></div>
</body>
</html>
/*
* Ext JS Library 2.2.1
* Copyright(c) 2006-2009, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
Ext.onReady(function() {
var form = new Ext.form.FormPanel({
baseCls: 'x-plain',
layout:'absolute',
url:'save-form.php',
defaultType: 'textfield',
items: [{
x: 0,
y: 5,
xtype:'label',
text: 'Send To:'
},{
x: 60,
y: 0,
name: 'to',
anchor:'100%' // anchor width by percentage
},{
x: 0,
y: 35,
xtype:'label',
text: 'Subject:'
},{
x: 60,
y: 30,
enableKeyEvents: true,
name: 'subject',
anchor: '100%', // anchor width by percentage
listeners: {
keyup: function(src, evt){
alert(src.getValue());
}
}
},{
x:0,
y: 60,
xtype: 'textarea',
name: 'msg',
enableKeyEvents: true,
anchor: '100% 100%', // anchor width and height,
listeners: {
keyup: function(src, evt){
alert(src.getValue());
}
}
}]
});
var window = new Ext.Window({
title: 'Resize Me',
width: 500,
height:300,
minWidth: 300,
minHeight: 200,
layout: 'fit',
plain:true,
bodyStyle:'padding:5px;',
buttonAlign:'center',
items: form,
buttons: [{
text: 'Send'
},{
text: 'Cancel'
}]
});
window.show();
});