怎么才能实现我的这个登录界面实现在屏幕中央
向往编程 2019-06-25 08:50:49 <!DOCTYPE html>
<html long="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>login</title>
<style type="text/css">
body
{
width: device-width;
height: auto;
background-image: url(images/background_boy.jpg);
background-repeat: no-repeat;
background-size: 100%;
}
</style>
<script>
function checkLogon()
{
var name = document.getElementById("username").value;
var pass = document.getElementById("password").value;
if((name==null || name=="") || (pass==null || pass==""))
{
alert("The user name or password cannot be empty");
}
else{
if(name=="Alex" && pass=="12356")
{
alert("creat successfull");
window.location.href="index.html";
}
else{
alert("The user name or password error");
}
}
}
</script>
</head>
<body>
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25">Username</td>
<td><input name="textfield" type="text" size="14" id="username"></td>
</tr>
<tr>
<td height="25">password</td>
<td><input name="textfield2" type="text" size="14" id="password"></td>
</tr>
<tr>
<td height="25" colspan="2"><div align="center">
<input type="submit" name="Submit" value="login" onClick="checkLogon()">
</div></td>
</tr>
</table>
</body>
</html>