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
欢迎任何形式的转载,但请务必注明出处。
分享到:
查看全文
相关阅读:
C#快速随机按行读取大型文本文件
OpenReadWithHttps
fiddler不能监听 localhost和 127.0.0.1的问题 .
C#放缩、截取、合并图片并生成高质量新图的类
JS判断只能是数字和小数点
HTML5 Support In Visual Studio 2010
GridView 获取列字段的几种途径
微信朋友圈如何同时分享(图片+文字) Android版
【Android】 PopupWindow使用小结
Android 第三方应用接入微信平台(2)
原文地址:https://www.cnblogs.com/xwdreamer/p/2296922.html
最新文章
Simple Factory (简单工厂模式)
Static Proxy (静态代理模式)
Dynamic Proxy (动态代理模式)
Template Method (模板方法模式)
Adapter (适配器模式)
Composite (组合模式)
Decorator Pattern (装饰者模式)
Singleton Pattern (单例模式)
Response实现文件下载
(八):构建WineLib DLL
热门文章
Java与设计模式-责任链模式
[leetcode]Combination Sum II
Windows 10遭遇百万粉丝“围攻”(挑刺)
华为练习题--社交好友推断
POJ-1005
Android数据自己主动更新库DataAutoRefresh
Python实战之自己主动化评论
POJ 1160 Post Office
哇!板球 源代码分析一
winform制作自定义控件
Copyright © 2011-2022 走看看