<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml"> <head runat="server"> <title>无标题页</title> <link rel="stylesheet" type="text/css" href="js/ext/resources/css/ext-all.css" /> <script type="text/javascript" src="js/ext/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="js/ext/ext-all.js"></script> </head> <body> <form id="form1" runat="server"> <div> <script type="text/javascript"> Ext.onReady(function(){ var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."}); //LoadMask类来执行第一张图所示的效果 myMask.show(); //执行
//以下为loginWin 窗口的构造代码,不懂的可以查考一下EXT手册 loginWin=new Ext.Window({ width:300,height:150,title:'网站管理登陆系统Ver 1.0',plain:true,closable:false,resizable:false, frame:true,layout:'fit',closeAction:'hide',border:false,modal:true, items:[ loginForm=new Ext.form.FormPanel({ labelAlign:'left',buttonAlign:'center',bodyStyle:'padding:5px',frame:true,labelWidth:80, items:[ {xtype:'textfield',name:'username',fieldLabel:'用户名称',allowBlank : false,anchor:'90%',enableKeyEvents:true, listeners:{ keypress:function(field,e){ if(e.getKey()==13){ var obj=loginForm.form.findField("username"); if(obj) { obj.focus(); } } } }}, {xtype:'textfield',inputType:'password',name:'password',fieldLabel:'用户密码',allowBlank : false,anchor:'90%',enableKeyEvents:true, listeners:{ keypress:function(field,e){ if(e.getKey()==13){ var obj=loginForm.form.findField("password"); if(obj) { obj.focus(); } } } }}], buttons:[{id:"submitButton",text:'确定',scope:this,handler:function(){submit();}} ,{text:'重置',scope:this,handler:function(){loginForm.form.reset()}}] }) ] }); loginWin.show(); //执行loginWIn 使窗口显示出来 myMask.hide(); //loadMask 隐藏/关闭
//下面发送并返回结果
submit=function(){ if(loginForm.form.isValid()){ loginForm.form.doAction('submit',{ url:'checklogin.ashx', method:'post', params:'', success:function(form,action){ var result=action.result.data; if(result=='ok'){ Ext.Msg.alert('成功','恭喜您,您已经成功登陆系统!'); }else if(typeof result=='object'){ }else{ Ext.Msg.alert('错误',action.result.data); } }, failure:function(){ Ext.Msg.alert('错误','发生错误!'); } }); } } })//onReady
</script> </div> </form> </body> </html>
|