|
网页代码如下,这个网页很奇怪,是打开一个网页,然后弹出一个小窗口,在小窗口上登陆,研究了很久也没有实现。而且登陆按钮,不是用button制作的,搞不懂,请高手赐教
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /><title>
网络办公自动化系统-登 陆
</title><link href="CSS/css.css" rel="stylesheet" type="text/css" /><link rel="stylesheet" type="text/css" href="css/style.css" /><link rel="stylesheet" type="text/css" href="Ext/resources/css/ext-all.css" />
<script type="text/javascript">
var bk="DSC07219.JPG";
function load()
{
if(bk=="") bk="default.png";
document.getElementById("bkpic").src="BK/"+bk;
}
function resizepic(pic)
{
var rpicht = ht-10;
var tpicwd = pic.width;
var tpicht = pic.height;
var multi = tpicht/rpicht;
pic.height = rpicht;
pic.width = tpicwd/multi;
}
</script>
</head>
<body onload="load()" >
<script src="Ext/adapter/ext/ext-base.js" type="text/javascript"></script>
<script src="Ext/ext-all.js" type="text/javascript"></script>
<script src="JS/globel.js" type="text/javascript"></script>
<script type="text/javascript">
Ext.onReady(function()
{
Ext.QuickTips.init();
Ext.BLANK_IMAGE_URL = 'ext/resources/images/default/s.gif';
var cp = new Ext.state.CookieProvider();
var uid = cp.get('userid');
var udpt = cp.get('userdept');
var UserDeptFields = Ext.data.Record.create([
{name: 'id',mapping:'id'},{name: 'userdept',mapping:'dept'}
]);
var UserDeptStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:'DATA/UserInfo/GetDepart.aspx'
}),
reader: new Ext.data.JsonReader({
root: 'data',
id: 'id'
},
UserDeptFields
)
});
UserDeptStore.load();
var UserFields = Ext.data.Record.create([
{name: 'id',mapping:'id'},{name: 'userid',mapping:'userid'} ,{name: 'userName',mapping:'userName'}
]);
var UserStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:'DATA/UserInfo/GetUser.aspx?id=',
method:'post'
}),
reader: new Ext.data.JsonReader({
root: 'data',
id: 'id'
},
UserFields
),
autoLoad:true,
listeners : {
load : function() {
yh.setValue(uid);
}
}
});
UserStore.load();
var bm = new Ext.form.ComboBox({
id:'DeptName',
name:'DeptName',
fieldLabel:'部 门',
store :UserDeptStore,
valueField : 'userdept',
displayField : 'userdept',
typeAhead : true,
mode : 'local',
width: 190,
triggerAction : 'all',
emptyText: '',
listeners:{
select : function(combo, record, index){
UserStore.proxy= new Ext.data.HttpProxy({url: 'DATA/UserInfo/GetUser.aspx?id=' + escape(combo.value)});
UserStore.load();
}
}
});
var yh = new Ext.form.ComboBox({
id:'TxtName',
name:'TxtName',
store :UserStore,
hiddenName:'userid',
fieldLabel:'用 户',
valueField : 'userid',
displayField : 'userName',
typeAhead : true,
mode : 'local',
width: 190,
triggerAction : 'all',
emptyText: ''
});
bm.setValue(udpt);
if(udpt!=""&&udpt!=null)
{
UserStore.proxy= new Ext.data.HttpProxy({url: 'DATA/UserInfo/GetUser.aspx?id=' + escape(udpt)});
UserStore.load();
yh.setValue(uid);
}
var loginForm=new Ext.FormPanel
({
bodyStyle:"padding:2px 0 0 15px",
border:false,
width:380,
labelWidth:70,
plain:true,
layout:"form",
baseCls:"x-plain",
items:[
{
boder:false,
bodyStyle:"margin:0px 0px 7px 0px",
html:'<img src="images/logo.png" height=47 width=344><br>'
},
{
boder:false,
bodyStyle:"margin:5px 0px 8px 0px",
plain:true
},
bm,
yh,
{
xtype: 'textfield',
inputType:'password',
fieldLabel:'密 码',
id:'TxtPwd',
name:'TxtPwd',
width:190,
allowBlank:false,
blankText:'密码不能为空'
}
/*
{
xtype: 'textfield',
fieldLabel:' 验证码 ',
id:'TxtCode',
name:'TxtCode',
width:80,
allowBlank:false,
blankText:'验证码不能为空'
},{
id:'CodeImge',
bodyStyle:"padding:0px 0px 0 70px",
boder:false,
html:''
}
*/
]
});
var loginWin=new Ext.Window({
title:"用户登录",
width:435,
height:235,
layout:"form",
iconCls:"usericon",
//不可以随意改变大小
resizable:true,
collapsible:false,
closeAction : 'close',
closable:true,
//modal: 'true',
buttonAlign:"center",
bodyStyle:"padding:5px 0 0 15px",
items:[loginForm],
listeners:{
"show":function()
{
loginForm.getForm().reset();
},
specialkey: function(e)
{
if (e.getKey() == e.ENTER) {
alert("回车事件");
}
}
},
buttons:[{
text:"登录",
minWidth:70,
handlernOk
}],
keys:[{
key: Ext.EventObject.ENTER,
fn: onOk ,
scope : this
}]
});
loginWin.show();
function onOk()
{
if(loginForm.getForm().isValid())
{
//弹出效果
Ext.MessageBox.show
(
{
msg: '正在登录系统,请稍等...',
progressText: 'loading...',
width:300,
wait:true,
waitConfig: {interval:200},
icon:'download',
animEl: 'loading'
}
);
setTimeout(function(){}, 1000);
loginForm.form.submit({
url:"URL/ValidateCode.aspx",
method:"OST",
success:function(form,action)
{
//成功后
var flag=action.result.success;
if(flag=="true")
{
var cp1 = new Ext.state.CookieProvider();
cp1.set('userid',Ext.get('userid').dom.value);
cp1.set('userdept',Ext.get('DeptName').dom.value);
window.location.href="Default.aspx";
}
else
{
var error = action.result.error;
//Ext.MessageBox.alert("提示信息",error);
alert(error);
window.location.reload();
}
},
failure:function(form,action)
{
Ext.MessageBox.alert("提示信息","登录失败!");
}
});
}
}
//document.getElementById('CodeImge').innerHTML='验证码图片:<img src="URL/Image.aspx" width=57 height=25 align="AbsMiddle"><input type="button" onclick="ReBtn()" value="看不清"><br>';
});
function ReBtn()
{
window.location.reload();
/*
Ext.Ajax.request({
url:"URL/Image.aspx",
method:"OST",
success:function()
{
document.getElementById('CodeImge').innerHTML='验证码图片:<img src="URL/Image.aspx" width=57 height=25 align="AbsMiddle"><input type="button" onclick="ReBtn()" value="看不清"><br>';
}
});
*/
}
</script>
<div align="center"><img src="BK/default.png" onload="resizepic(this)" style="vertical-align:middle;" id="bkpic"/></div>
</body>
</html> |
|