Ext-JS 学习一
2009-05-22 15:28
429 查看
1、对话框的种类:
a、prompt:弹出一个要求用户输入的对话框
b、alert:警告框
c、wait:为一个进度条
实例:
Ext.Msg.prompt('Milton', 'Where is it?', function(btn,txt)
{ if (txt.toLowerCase() == 'the office') {
Ext.get('my_id').dom.innerHTML = 'Dull Work';
}else{
Ext.get('my_id').dom.innerHTML = txt;
}
Ext.DomHelper.applyStyles('my_id',{
background: 'transparent
url(images/stapler.png) 50% 50% no-repeat'
});
});
说明:上面的Ext.get('my_id')是要获得DOM里面ID号为my_id的元素,然后就可以在这里进行操作,下面的Ext.getBody()也是获得DOM里面的Body元素。
b、
Ext.Msg.alert('Milton',
'Im going to burn the building down!',
function() {
Ext.DomHelper.applyStyles('my_id',{
'background': 'transparent
url(images/fire.png) 0 100% repeat-x'
});
Ext.DomHelper.applyStyles(Ext.getBody(),{
'background-color': '#FF0000'
});
Ext.getBody().highlight('FFCC00',{
endColor:'FF0000',
duration: 6
});
});
2、EXT-JS中自己定义验证方式:
验证方式一般是以vtype定义,所以我们要定义验证方式就要定义Vtype,每个定义都有一个value、mask、error text/和一个function used for testing:
xxxVal: This is the regular expression to match against
xxxMask: This is the masking to restrict user input
xxxText:This is the error message that is displayed
实例:
Ext.form.VTypes['nameVal'] = /^[A-Z][A-Za-z\-]+
[A-Z][A-Za-z\-]+$/;
Ext.form.VTypes['nameMask'] = /[A-Za-z\- ]/;
Ext.form.VTypes['nameText'] = '不允许的排列方式 for Name.';
Ext.form.VTypes['name'] = function(v){
return Ext.form.VTypes['nameVal'].test(v);
a、prompt:弹出一个要求用户输入的对话框
b、alert:警告框
c、wait:为一个进度条
实例:
Ext.Msg.prompt('Milton', 'Where is it?', function(btn,txt)
{ if (txt.toLowerCase() == 'the office') {
Ext.get('my_id').dom.innerHTML = 'Dull Work';
}else{
Ext.get('my_id').dom.innerHTML = txt;
}
Ext.DomHelper.applyStyles('my_id',{
background: 'transparent
url(images/stapler.png) 50% 50% no-repeat'
});
});
说明:上面的Ext.get('my_id')是要获得DOM里面ID号为my_id的元素,然后就可以在这里进行操作,下面的Ext.getBody()也是获得DOM里面的Body元素。
b、
Ext.Msg.alert('Milton',
'Im going to burn the building down!',
function() {
Ext.DomHelper.applyStyles('my_id',{
'background': 'transparent
url(images/fire.png) 0 100% repeat-x'
});
Ext.DomHelper.applyStyles(Ext.getBody(),{
'background-color': '#FF0000'
});
Ext.getBody().highlight('FFCC00',{
endColor:'FF0000',
duration: 6
});
});
2、EXT-JS中自己定义验证方式:
验证方式一般是以vtype定义,所以我们要定义验证方式就要定义Vtype,每个定义都有一个value、mask、error text/和一个function used for testing:
xxxVal: This is the regular expression to match against
xxxMask: This is the masking to restrict user input
xxxText:This is the error message that is displayed
实例:
Ext.form.VTypes['nameVal'] = /^[A-Z][A-Za-z\-]+
[A-Z][A-Za-z\-]+$/;
Ext.form.VTypes['nameMask'] = /[A-Za-z\- ]/;
Ext.form.VTypes['nameText'] = '不允许的排列方式 for Name.';
Ext.form.VTypes['name'] = function(v){
return Ext.form.VTypes['nameVal'].test(v);
相关文章推荐
- 20101013认真学习js和ext
- Ext原码学习之Ext.js
- ExtJs 4.x 学习小记:Ext.require动态加载js文件
- Ext-js 学习笔记
- 阅读Ext 学习Javascript(一)Core/Ext.js
- 分享几个Ext.js 学习的地方
- 阅读Ext 学习Javascript(一)Core/Ext.js
- Ext.js学习心得二
- 学习EXT.JS5时的重点载图
- Ext原码学习之Ext-more.js
- 【ext学习笔记】JS获取各种浏览器窗口的大小
- Ext原码学习之lang-Object.js
- 阅读Ext 学习Javascript(一)Core/Ext.jsjavascript
- Ext JS学习第十天 Ext基础之动态加载JS文件(补充)
- golang+beego+ext.js+mysql学习第一课
- ext4 学习笔记(六)[Ext.js方法 ](白鹤翔第一季)
- Ext原码学习之lang-Array.js
- Ext JS学习第八天 Ext基础之 认识Ext.js 和Ext-more.js
- Ext.JS学习之入门理解与helloword
- EXT-JS学习系列基础篇:第三篇(转载)作者殷良胜