87,921
社区成员
发帖
与我相关
我的任务
分享
<!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="Content-Type" content="text/html; charset=utf-8" />
<title>用户登录</title>
<link type="text/css" rel="Stylesheet" href="css.css" />
</head>
<script language="javascript"> //判空
function isfull(){
if (document.dd.username.value==""){
alert("用户名不能为空");
document.dd.username.focus();
return false;
}
if (document.dd.password.value==""){
alert("密码不能为空");
document.dd.password.focus();
return false;
}
return true;}
</script>
<body style="text-align:center">
<form name="dd" method="post" action="" onSubmit="return isfull();">
<p><input id="pw0" name ="username" placeholder="用户名" type="text" /></p>
<p><input id="pw0" name="password" placeholder="密码" type="password" /></p>
<input type="submit" data-inline="true" id="bu" name="Submit" value="登陆" onclick= />
</body>
</html>
<!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="Content-Type" content="text/html; charset=utf-8" />
<title>用户登录</title>
<link type="text/css" rel="Stylesheet" href="css.css" />
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
</head>
<script language="javascript"> //判空
function isfull(){
if (document.dd.username.value==""){
alert("用户名不能为空");
document.dd.username.focus();
return false;
}
if (document.dd.password.value.length < 6 || document.dd.password.value.length > 20){
alert("密码格式有误");
document.dd.password.focus();
return false;
}
$.ajax({
type: "POST",
url: "数据接口地址",
async: false,//同步
data: "name="+document.dd.username.value+"&pwd="+document.dd.password.value,
success: function(msg){
//判断是否成功 成功return true;失败return false;
}
});
}
</script>
<body style="text-align:center">
<form name="dd" method="post" action="" onSubmit="return isfull();">
<p><input id="pw0" name ="username" placeholder="用户名" type="text" /></p>
<p><input id="pw0" name="password" placeholder="密码" type="password" /></p>
<input type="submit" data-inline="true" id="bu" name="Submit" value="登陆" onclick= />
</body>
</html>