国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

JS小練習代碼之二第1/2頁

2024-05-06 14:17:00
字體:
來源:轉載
供稿:網友
相關的源代碼如下:
1.beginFormPanel.js(作用:外層html文件中表單的展現)
<script>
var beginFormPanel = Ext.extend(Ext.form.FormPanel,{
constructor:function()
{
beginFormPanel.superclass.constructor.call
(
this,
{
title:"myForm(絕不裸奔)",
width:418,
height:180,
frame:true,
labelWidth:45,
style:"margin-left:250px",
defaultType:"textfield",
defaults:{anchor:"95%"},
items:
[
{
fieldLabel:"姓名",
name:"name"
},
{
fieldLabel:"年齡",
name:"age"
},
{
fieldLabel:"性別",
name:"sex"
},
{
fieldLabel:"住址",
name:"addr"
}
],
buttons:
[
{
text:"添加"
},
{
text:"修改"
},
{
text:"刪除"
}
],
renderTo:Ext.getBody()
}
) ;
}
}) ;
</script>
2.beginPanel.js(作用:GridPanel與窗口以及窗口中FormPanel的實現)
<script>
/**************************** FormPanel *****************************************************/
var myWindowForm = Ext.extend(Ext.form.FormPanel,{
constructor:function()
{
myWindowForm.superclass.constructor.call
(
this,
{
labelWidth:45,
defaultType:"textfield",
defaults:{anchor:"93%"},
style:"padding:5px",
baseCls:"x-plain",
items:
[
{
fieldLabel:"姓名",
name:"name",
allowBlank:false,
blankText:"姓名不能夠為空!"
},
{
fieldLabel:"年齡",
name:"age",
allowBlank:false,
vtype:"age",
blankText:"年齡不能夠為空!"
},
{
fieldLabel:"性別",
name:"sex",
allowBlank:false,
blankText:"性別不能夠為空!"
},
{
fieldLabel:"住址",
name:"addr",
allowBlank:false,
blankText:"住址不能夠為空!"
}
]
}
) ;
},
getValues:function()
{
if(this.getForm().isValid())
{
return new Ext.data.Record(this.getForm().getValues()) ;
}
else
{
throw error("表單驗證沒通過哦!") ;
}
},
setValues:function(record)
{
this.getForm().loadRecord(record) ;
},
reset:function()
{
this.getForm().reset() ;
}
}) ;
/******************************** Window ***********************************/
var myWindow = Ext.extend(Ext.Window,{
form:new myWindowForm(),
constructor:function()
{
myWindow.superclass.constructor.call
(
this,
{
title:"myWindow(絕不裸奔)",
width:300,
height:185,
frame:true,
plain:true,
modal:true,
items:this.form,
closable:false,//禁止關閉
collapsible:true,//可折疊
buttons:
[
{
text:"確定",
handler:this.onSubmitClick,
scope:this
},
{
text:"取消",
handler:this.onCancelClick,
scope:this
}
]
}
) ;
this.addEvents("submit") ;
},
close:function()
{
this.hide() ;
},
onSubmitClick:function()
{
/*
try
{
this.fireEvent("submit",this,this.form.getValues()) ;
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 河津市| 江油市| 南岸区| 昭觉县| 静乐县| 福安市| 琼结县| 余干县| 竹溪县| 扎兰屯市| 鲜城| 五常市| 洞口县| 贵溪市| 宁陵县| 大冶市| 五指山市| 黄石市| 微山县| 饶河县| 故城县| 永德县| 托里县| 仁布县| 岳阳市| 宜黄县| 稷山县| 桦川县| 黄陵县| 青田县| 潞西市| 青阳县| 福鼎市| 德安县| 松滋市| 清苑县| 鹤壁市| 平山县| 大埔区| 得荣县| 阿拉善右旗|