Ext-JS 学习一

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);

转载于:https://www.cnblogs.com/ocean010/archive/2009/05/22/1487145.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值