ext写的登录框如何使登录焦点光标一开始就出现在登录框,一打开页面光标就出现在登录文本框里
3条回答 默认 最新
- yougucao379548695 2010-01-25 13:45关注
[code="java"]
Ext.onReady(function() {
Ext.QuickTips.init(); Ext.form.Field.prototype.msgTarget = 'side'; var path = window.location.pathname; var loginform = new Ext.FormPanel({ labelAlign : 'right', title : 'ixcom通信中间件 v3.5 ', buttonAlign : 'right', width : 260, frame : true, url : path+"login.do", plain : true, defaultType : 'textfield', labelWidth : 50, labelSeparator : ':', bodyStyle:'padding:3px 3px 0', //defaultButton:0, listeners : { 'render' : function() { this.findByType('textfield')[0].focus(true, true); //第一个textfield获得焦点,加到这里 } }, items : [{ cls:'user', fieldLabel : '帐号', id:'username', name : 'username', width:130, allowBlank : false }, { cls:'key', fieldLabel : '密码', name : 'userpassword', inputType : 'password', width:130, allowBlank : false }], buttons : [ { text : '登陆', defaultButton:0, handler : function() { var form = loginform.getForm().submit( { waitTitle : '请稍候', waitMsg : '正在登录......', timeout:120, success : function() { //alert("login success"); window.location = path; }, failure : function(form,action) { Ext.MessageBox.alert('错误', action.result.msg); } } ); } }, { text : '重置', handler : function() { loginform.getForm().reset(); } }], //defaultButton:0, keys:[ {key : Ext.EventObject.ENTER, fn : function() { var form = loginform.getForm().submit( { waitTitle : '请稍候', waitMsg : '正在登录......', timeout:120, success : function() { //alert("login success"); window.location = path; }, failure : function(form,action) { Ext.MessageBox.alert('错误', action.result.msg); } } ); }, scope : this }] }) var path = window.location.pathname; path += "main/show.jsp"; loginform.render("login");
})
[/code]
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 perl MISA分析p3_in脚本出错
- ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
- ¥15 ubuntu虚拟机打包apk错误
- ¥199 rust编程架构设计的方案 有偿
- ¥15 回答4f系统的像差计算
- ¥15 java如何提取出pdf里的文字?
- ¥100 求三轴之间相互配合画圆以及直线的算法
- ¥100 c语言,请帮蒟蒻写一个题的范例作参考
- ¥15 名为“Product”的列已属于此 DataTable
- ¥15 安卓adb backup备份应用数据失败