extjs做的一个登陆

xiaoxiao2026-04-16  3

Ext.onReady(function() { Ext.QuickTips.init(); Ext.form.Field.prototype.msgTarget = "side"; var simple = new Ext.FormPanel({ height : 300, width : 500, defaultType : "textfield", labelWidth : 75, defaults : { width : 100 }, baseCls : "x-plane", items : [{ fieldLabel : "用户名", name : "name", allowBlank : false }, { fieldLabel : "密码", name : "password", inputType : "password", allowBlank : false }], buttons : [{ text : "登陆", type : "submit", // 按钮点击事件 handler : function() { if (simple.form.isValid()) { Ext.MessageBox.show({ title : "请等待....", progress : true, width : 300 }); // 设置延迟加载 var f = function(v) { return function() { var i = v / 10; Ext.MessageBox.updateProgress(i, '加载中...'); }; }; for (var i = 0; i < 10; i++) { setTimeout(f(i), i * 200); } simple.form.doAction('submit', { url : "login.do",//一个Servlet路径 验证使用是否存在 method : "post", params : "param:add", success : function(form, action) { if (action.result.msg == 'ok') { // 加载到首页 document.location = 'index.jsp'; } else { Ext.MessageBox.alert("信息", action.result.msg); } } }); } } }, { text : "关闭", type : "reset", handler : function() { // 清除信息 simple.form.reset(); } }] }); var win = new Ext.Window({ title : "<center>用户登陆</center>", width : 300, height : 150, bodyStyle : "padding:5px;", plane : true, layout : "fit", closable : false, items : simple, collapsible : true,// 设置是否可则叠 expandOnShow : false, maximizable : false,// 禁止最大化 buttonAlign : "center" }); win.show(); simple.render("show"); }); 希望对刚刚入门的朋友有帮助 如果有问题请联系本人QQ:86780004 Email :www.xiaohewoai@163.com 有兴趣学习的可以加群:java技术群:69705156 相关资源:ExtJs 表单提交登陆实现代码
转载请注明原文地址: https://www.6miu.com/read-5047476.html

最新回复(0)