zoukankan
html css js c++ java
ExtJS带验证码登录框[新增回车提交]
原文地址:
http://ht19820316.blog.163.com/blog/static/3395523320113222421670/
/* * 用户带验证码登录页面 * sheak * code.php 生成验证码 * 1202增加键盘回车提交功能(粗体部分) */ /* * 用户带验证码登录页面 * sheak 081115 * code.php 生成验证码 */ Ext.QuickTips.init(); LoginWindow = Ext.extend( Ext.Window, { title : '登陆系统', width : 275, height : 155, collapsible : true, defaults : { border : false }, buttonAlign : 'center', createFormPanel : function() { // 表单重置函数 function reset() { myform.form.reset(); } ; // 表单提交函数,这个是重点,单独提取出来,与myform一个层级 function subjectForm() { if (myform.getForm().isValid()) { myform.form.submit({ waitMsg : '正在登录......', url : '../../../index/login', timeout : 3000, success : function(form, action) { if (action.result.type == 0)// OP window.location.href = '../op/index.html'; else window.location.href = 'index.html'; }, failure : function(form, action) { form.reset(); if (action.failureType == Ext.form.Action.SERVER_INVALID) Ext.MessageBox .alert( '警告', action.result.errors.msg); } }); } } ; var myform = new Ext.form.FormPanel({ bodyStyle : 'padding-top:6px', defaultType : 'textfield', labelAlign : 'right', labelWidth : 55, labelPad : 2, // frame : true, method : 'POST', // 增加表单键盘事件,键盘按键10或者13会触发subjectForm方法 keys : [ { key : [ 10, 13 ], fn : subjectForm } ], defaults : { allowBlank : false, width : 158 }, items : [ { cls : 'user', name : 'username', fieldLabel : '帐 号', blankText : '帐号不能为空' }, { cls : 'key', name : 'password', fieldLabel : '密 码', blankText : '密码不能为空', inputType : 'password' }, { cls : 'key', name : 'randCode', id : 'randCode', fieldLabel : '验证码', width : 70, blankText : '验证码不能为空' } ], buttons : [ { text : '确定', id : 'sure', handler : subjectForm//鼠标按键提交表单 }, { text : '重置', id : 'clear', handler : reset } ] }); return myform; }, initComponent : function() { LoginWindow.superclass.initComponent.call(this); this.fp = this.createFormPanel(); this.add(this.fp); } }); Ext.onReady(function() { var win = new LoginWindow(); win.show(); var bd = Ext.getDom('randCode'); var bd2 = Ext.get(bd.parentNode); bd2.createChild({ tag : 'img', src : 'code.php', align : 'absbottom' }); });
作者:
xwdreamer
出处:
http://www.cnblogs.com/xwdreamer
欢迎任何形式的转载,但请务必注明出处。
分享到:
查看全文
相关阅读:
最易理解的傅里叶分析讲解
python获取最大、最小值
机器学习周志华——学习器性能度量
机器学习周志华——模型评估与选择
机器学习周志华——机器学习重要会议及期刊
机器学习周志华——机器学习的应用领域
机器学习周志华——机器学习的发展
在github上保存vscode的配置(后续重新安装vscode时,可以十分方便地从github上下载安装这个保存的配置)
windows 10 macbook air 无声音
监控 4MM 6MM 8MM 选择
原文地址:https://www.cnblogs.com/xwdreamer/p/2296922.html
最新文章
闭包函数及装饰器
day14作业
day11整理
SQL优化
java使用ftp上传下载
常用SQL笔记
Linux平台使用Docker安装RabbitMQ
Linux平台安装 mysql
139.用户系统案例
138.更改session的存储机制
热门文章
137.在Django中操作session
135.在django中操作cookie
134.cookie、session的工作机制
133.在django中使用memcached
127.限制上传文件的类型
126.自动处理上传的文件,获取上传文件的url
125.文件上传基本流程
169.权限-权限验证装饰器
傅里叶分析讲解三
傅里叶分析讲解二
Copyright © 2011-2022 走看看