<body> <h1 class="margin">注册界面</h1> <form name="loginfrm" action="Register" method="post" class="margin" onsubmit="return a()"> <table> <tr> <td>用户名:</td> <td><input type="text" name="username" class="textrange"></td> </tr> <tr> <td>密 码:</td> <td><input type="password" name="password1" class="textrange"></td> <tr> <td>新密码:</td> <td><input type="password" name="password2" class="textrange"></td> </tr> </table> <input name="button" type="submit" value="注册" > </form> </body>美化这段代码
时间: 2023-10-22 20:05:21 浏览: 43
<body>
<div class="container">
<h1 class="title">注册界面</h1>
<form name="loginfrm" action="Register" method="post" class="form" onsubmit="return validate()">
<div class="form-group">
<label for="username">用户名:</label>
<input type="text" name="username" id="username" class="input-text">
</div>
<div class="form-group">
<label for="password1">密码:</label>
<input type="password" name="password1" id="password1" class="input-text">
</div>
<div class="form-group">
<label for="password2">确认密码:</label>
<input type="password" name="password2" id="password2" class="input-text">
</div>
<div class="button-group">
<input name="button" type="submit" value="注册" class="button">
</div>
</form>
</div>
</body>
<style>
.container {
margin: 0 auto;
width: 500px;
}
.title {
margin: 30px 0;
text-align: center;
font-size: 36px;
}
.form {
background-color: #f7f7f7;
padding: 20px;
border-radius: 5px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-size: 18px;
}
.input-text {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
.button-group {
margin-top: 20px;
text-align: center;
}
.button {
padding: 10px 20px;
background-color: #0072c6;
color: #fff;
border: none;
border-radius: 5px;
font-size: 18px;
cursor: pointer;
}
.button:hover {
background-color: #005499;
}
</style>
<script>
function validate() {
var username = document.getElementById("username").value.trim();
var password1 = document.getElementById("password1").value.trim();
var password2 = document.getElementById("password2").value.trim();
if (username === "" || password1 === "" || password2 === "") {
alert("请填写完整信息!");
return false;
}
if (password1 !== password2) {
alert("两次密码输入不一致!");
return false;
}
return true;
}
</script>
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
<body> 教师登录 <form name="loginfrm" action="TServlet" method="post" class="margin"> 用户名: <input type="text" name="username" class="textrange" class="textrange"> 密 码: <input type="password" name="password1" class="textrange"> 验证码:
<input type="text" class="inputgri" name="checkCode" id="code" onblur="checkInputCode();"/>
<input name="button" type="submit" value="登录" onclick="">
没有账户,点击注册 </form> 让它变得炫酷
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)