六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 72|回复: 0

Ext登陆窗口(有验证码的)

[复制链接]

升级  41.33%

28

主题

28

主题

28

主题

秀才

Rank: 2

积分
112
 楼主| 发表于 2013-1-29 07:32:42 | 显示全部楼层 |阅读模式
Ext登陆窗口代码,关键代码位于 login.js 中
html代码:

<span style="color: #000000;">

  • <!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN">

  • <html>

  • <head>

  • <title>wayfoon</title>

  • <metahttp-equiv="pragma"content="no-cache">

  • <metahttp-equiv="cache-control"content="no-cache">

  • <metahttp-equiv="expires"content="0">

  • <metahttp-equiv="keywords"content="keyword1,keyword2,keyword3">

  • <linkrel="stylesheet"type="text/css"

  • href="../ext/resources/css/ext-all.css">

  • <scripttype="text/javascript"src="../ext/ext-base.js"></script>

  • <scripttype="text/javascript"src="../ext/ext-all.js"></script>

  • <SCRIPTtype="text/javascript"src="../js/login.js"></SCRIPT>

  • <linkrel="stylesheet"type="text/css"href="../ext/resources/css/xtheme-slate.css"/>

  • <SCRIPTtype="text/javascript"src="../ext/ext-lang-zh_CN.js"></SCRIPT>

  • <scripttype="text/javascript">

  • Ext.onReady(function()

  • {

  • Ext.MessageBox.alert('haha','o(∩_∩)o...哈哈');

  • })

  • </script>

  • </head>



  • <body>

  • </body>

  • </html>

login.js 代码:
<div class="highlighter">

  • Ext.onReady(function(){
  • //开启表单提示
  • Ext.QuickTips.init();
  • //设置提示信息位置为边上
  • Ext.form.Field.prototype.msgTarget='side';
  • varwin=newExt.Window({
  • id:'login-win',
  • title:'登陆',
  • iconCls:'tabs',
  • width:300,
  • height:120,
  • collapsible:true,
  • plain:true,
  • //初始化表单面板
  • items:newExt.form.FormPanel({
  • id:'login-form',
  • labelWidth:50,//默认标签宽度板
  • labelAlign:'right',
  • buttonAlign:'center',
  • //不设置该值,表单将保持原样,设置后表单与窗体完全融合
  • baseCls:'header',
  • layout:'form',
  • defaults:{
  • width:200
  • },
  • //默认字段类型
  • defaultType:'textfield',
  • items:[{
  • id:'username',
  • fieldLabel:'账号',
  • allowBlank:false
  • //禁止为空
  • },{
  • id:'password',
  • inputType:'password',
  • fieldLabel:'密码',
  • allowBlank:false
  • }],
  • //初始化按钮
  • buttons:[{
  • text:'登陆',
  • type:'submit',
  • handler:function(){
  • varbut=this;
  • but.setDisabled(true);
  • this.setText('正在登陆');
  • //将表单提交
  • Ext.getCmp('login-form').getForm().submit({
  • url:'/XXX/login.action',
  • method:"POST",
  • success:function(form,action){
  • document.location='/XXX/main.jsp';
  • },
  • failure:function(){
  • but.setText("登陆");
  • but.setDisabled(false);
  • }
  • });
  • }
  • }]
  • })
  • });
  • //将窗口显示出来
  • win.show();
  • });

您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表