![08.jpg 08.jpg](http://meetrice.yo2.cn/wp-content/uploads/171/17138/2008/05/121084418198-08-tn.jpg)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ext form render</title>
<link rel='stylesheet' href='ext-all.css'>
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
<style type='text/css'>
.x-form-field-wrap {
}{display:inline;} /**//* display DateFields inline */ .x-form-field-wrap .x-form-date-trigger-nonie {
}{top:-1px;} /**//* remove 1px top padding for non-IE browsers */ </style>
<link rel="stylesheet" type="text/css"
href="framework/ext-2.0.2/resources/css/ext-all.css" />
<script type="text/javascript"
src="framework/ext-2.0.2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="framework/ext-2.0.2/ext-all.js"></script>
<script type="text/javascript"
src='framework/ext-2.0.2/adapter/yui-utilities.js'></script>
</head>
<body>
<div class="x-box-tl">
<div class="x-box-tr">
<div class="x-box-tc"></div>
</div>
</div>
<div class="x-box-ml">
<div class="x-box-mr">
<div class="x-box-mc">
<form id="form2" method="post">
<h3>表单范例</h3>
<table>
<tr>
<td class="title">文字输入:</td>
<td style="font-family: verdana;"><input type="text" id="tf"
name="text2" /></td>
</tr>
<tr>
<td class="title">下拉选单:</td>
<td style="font-family: verdana;"><select id="cb" name="st2">
<option></option>
<option>Aeiou</option>
<option>Andy</option>
<option>Amy</option>
<option>Aloha</option>
<option>Apple</option>
<option>Application</option>
<option>Aprik</option>
<option>Backup</option>
<option>Book</option>
</select></td>
</tr>
<tr>
<td class="title">日期选择:</td>
<td style="font-family: verdana;"><input type="text" id="df"
name="df" /></td>
</tr>
<tr>
<td class="title">多行输入:</td>
<td><textarea id="ta2" name="ta" cols="50" rows="6"></textarea></td>
</tr>
<tr>
<td class="title"></td>
<td>
<div id="btn"></div>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<div class="x-box-bl">
<div class="x-box-br">
<div class="x-box-bc"></div>
</div>
</div>
</body>
</html>
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
<script type='text/javascript'>
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
Ext.onReady(function()
{
// 定义表单
userForm = new Ext.form.BasicForm('form2');
// 渲染输入框
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
var tf = new Ext.form.TextField(
{
applyTo: 'tf',
id: 'tf',
allowBlank: false,
width: 340
});
// 渲染下拉框
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
var cb = new Ext.form.ComboBox(
{
transform: 'cb'
});
// 渲染日历框
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
var df = new Ext.form.DateField(
{
applyTo: 'df',
timePicker: true
});
// 渲染文本域
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
var ta = new Ext.form.TextArea(
{
applyTo: 'ta'
});
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
var btn = new Ext.Button(
{
applyTo: 'btn',
text: '提交'
});
userForm.add(tf);
userForm.add(df);
userForm.add(cb);
// 覆写日历
Date.dayNames = ["日", "一", "二", "三", "四", "五", "六"];
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (Ext.DatePicker)
{
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
Ext.apply(Ext.DatePicker.prototype,
{
todayText: "今天",
minText: "日期在最小日期之前",
maxText: "日期在最大日期之后",
disabledDaysText: "",
disabledDatesText: "",
monthNames: Date.monthNames,
dayNames: Date.dayNames,
nextText: '下月 (Control+Right)',
prevText: '上月 (Control+Left)',
monthYearText: '选择一个月 (Control+Up/Down 来改变年)',
todayTip: "{0} (Spacebar)",
okText: "确定",
cancelText: "取消",
format: "y年m月d日"
});
}
});
</script>
![](/Images/OutliningIndicators/None.gif)
posted @
2008-05-23 20:57
meetrice
阅读(
1766)
评论()
编辑
收藏
举报