<!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>
<title></title>
<script src="Script/jQueryLibs/jquery.js" type="text/javascript"></script>
<script src="Script/jQueryLibs/jquery.blockUI.js" type="text/javascript"></script>
<script src="Script/jQueryLibs/jquery.hotkeys.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
jQuery.hotkeys.add('return', function() {
$('#Submit').click();
});
$('#UserName').focus();
$('#Reg').click(function() {
$.blockUI({
message: $('#RegBox')
})
})
$('#RegSubmit').click(function() {
var RegUserName = $.trim($('#RegUserName').val());
var RegPassWord = $.trim($('#RegPassWord').val());
var RegEmail = $.trim($('#RegEmail').val());
var RegMobilePhone = $.trim($('#RegMobilePhone').val());
if (RegUserName == '' || RegPassWord == '' || RegEmail == '') return;
$.ajax({
url: '/WebService/ToJson.ashx?Torrent=Reg',
type: 'POST',
data: 'UserName=' + RegUserName + '&PassWord=' + RegPassWord + '&Email=' + RegEmail + '&MobilePhone=' + RegMobilePhone,
success: function(msg) {
$.blockUI({
message: msg == "true" ? "注册成功,正在转入管理平台" : "注册失败,帐号名或信息地址有重复"
});
window.setTimeout(function() {
$.unblockUI();
if (msg == "true")
location.href = "Torrent/JQuery.htm"
}, 1000);
}
})
})
$('#Submit').click(function() {
var UserName = $.trim($('#UserName').val());
var PassWord = $.trim($('#PassWord').val());
if (UserName == '' || PassWord == '') return;
$.blockUI({
message: '正在登陆'
});
$.ajax({
url: '/WebService/ToJson.ashx?Torrent=Login',
type: 'POST',
data: 'UserName=' + UserName + '&PassWord=' + PassWord,
success: function(msg) {
$.blockUI({
message: msg == "true" ? "验证通过" : "验证失败"
});
window.setTimeout(function() {
$.unblockUI();
if (msg == "true")
location.href = "Torrent/JQuery.htm"
}, 1000);
}
})
})
})
</script>
</head>
<body>
<div id="middle">
<div id="LoginBox" style="margin: 0 auto; text-align: center; width: 930px;">
<ul>
<li>
<label>
帐号</label><input id="UserName" size="22" type="text" /></li>
<li>
<label>
密码</label><input id="PassWord" size="22" type="password" /></li>
<li>
<input id="Submit" type="button" value="登陆" />
<input id="Reg" type="button" value="注册" /></li>
</ul>
</div>
<div id="RegBox" style="display: none; width: 220px; text-align: left">
<ul>
<li>
<label>
帐号</label><input id="RegUserName" type="text" size="22" /></li>
<li>
<label>
密码</label><input id="RegPassWord" type="password" size="22" /></li>
<li>
<label>
邮箱</label><input id="RegEmail" type="text" size="22" /></li>
<li>
<label>
手机</label><input id="RegMobilePhone" type="text" size="22" /></li>
<li style="text-align: center">
<input id="RegSubmit" type="button" value="提交" /><input type="button" value="取消"
onclick='$.unblockUI()' /></li>
</ul>
</div>
</div>
</body>
</html>
用jquery的dialog做,刷新是通过location = location来做
thickbox
这么简单的东西,自己动手吧
顶一下。。 不错
jquery