extjs相关的参考代码

2016-06-08 14:56:59  访问(1686) 赞(0) 踩(0)

function ready() {
    Ext.QuickTips.init();
    var win = new Ext.Panel
                                ({
                                    height: 203,
                                    width: 272,
                                    layout: 'absolute',
                                    closable: false,
                                    draggable: false,
                                    title: '',
                                    frame: false,
                                    
                                    border:false,
                                    //bodyStyle: 'background:#ffc',
                                    html: '<img id="bgImg" src="./content/images/loginbox.jpg"/>',
                                    titleAlign: 'center',
                                    resizable: false,
                                    renderTo: Ext.get('lo'),
                                    items: [
                                            {
                                                xtype: 'button',
                                                id: 'login', 
                                                x: 110,
                                                y: 130,
                                                width: 58,
                                                height: 46,
                                                cls: 'blucid', //设置按钮为透明
                                              //// html: '<img id="buttonelf" src="./buttonelf.JPG"/>',
                                                handler: login
                                            },
                                            {
                                                xtype: 'textfield',
                                                id: 'username',
                                                //allowBlank: false,
                                                cls:'border',height:18,
                                                //blankText: "请填写你的用户名",
                                                //emptyText: '用户登录名:',
                                                x: 107,
                                                y: 71.5,
                                                width: 118,
                                                fieldLabel: ''
                                            },
                                            {
                                                xtype: 'textfield',
                                                id: 'password',
                                                //allowBlank: false,
                                                cls: 'border', height: 18,
                                                //blankText: "请填写你的密码",
                                                //emptyText: '用户登录密码:',
                                                inputType: 'password',
                                                x: 107,
                                                y: 101.5,
                                                width: 118,
                                                fieldLabel: ''
                                            }
                                        ]
                                    
                                    //applyTo: 'test'

                                });

    win.show();

    function login() {
        var username = Ext.getCmp("username").getValue();
        var password = Ext.getCmp("password").getValue();

        if (username == "" || password == "") {
            alert("用户名,密码不得为空,请重新输入!");
            return;
        }
        else {
            password = hex_md5(password);

            Ext.Ajax.request
                     ({ url: 'Home.aspx?param=1',
                         params: { username: username,
                             password: password
                         },

                         success: function (response, option) {

                             var obj = Ext.util.JSON.decode(response.responseText);

                             if (obj[0].success == true) {
                                 //Ext.Msg.alert("eeeee12133");
                                 location.href = "admin/json.aspx";
                             }
                             else {
                                 Ext.Msg.alert(obj[0].info);
                             }
                         }

                     });
        }


    }

    function reset() {
        Ext.getCmp("username").setValue("");
        Ext.getCmp("password").setValue("");
    }

    /**var viewport = new Ext.Viewport
                                    ({
                                        id: 'vpApp',
                                        //layout: 'border',
                                        items: [
                                             win
                                            ]

                                    });*/

}

Ext.onReady(ready);


标签:extjs相关的参考代码 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)