<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>emmm</title>
</head>
<body>
<p>emmmmmm</p>
<script>
document.write(Date())
</script>
<button type="button" onclick=window.alert("用户名不能以数字开头")>Login</button>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录</title>
<link rel="stylesheet"type="text/css"href="../untitled1/static/css/emm.css">
<script>
function myLogin() {
var oUname = document.getElementById("name")
var oError = document.getElementById("error_box")
var opassword = document.getElementById("password")
if(oUname.value.length<6||oUname.value.length>20){
oError.innerText="用户名需为6-20位";
return;
}
else if(opassword.value.length<6||opassword.value.length>20){
oError.innerText="密码需为6-20位";
return;
}
else{
oError.innerHTML="";
}
}
</script>
</head>
<body>
<div class="aa" >
<div class="login" ><h2>登录</h2></div>
<div class="aa1" >
姓名:<input id="name" type="text"placeholder="请输入用户名"><br>
密码:<input id="password" type="password"placeholder="请输入密码"><br>
</div>
<div id="error_box"><br></div>
<div class="aa2" >
<button onclick="myLogin()">登录</button>
<button type="button" onclick=window.alert("是否取消登录!")>取消</button>
</div>
</body>
</html>
div{
margin:0 auto;
text-align:center;
backgroup-color:blue
}
.aa{
width:380px;
height:230px;
background-color: gold;
margin-top:200px;
}
.login{
font-size: 30px;
color: black;
font-family:幼圆;
}
.aa1{
font-size:30px;
font-weight:bold;
color: red;
font-family:幼圆;
}
.aa2{
width:150px;
height:60px;
boder-style:hidden;
}
.design{
font-size:10px;
color:yellowgreen;
}
#error_box{
color:red;
}