49 lines
2.7 KiB
HTML
49 lines
2.7 KiB
HTML
<html>
|
|
<head>
|
|
<title>Register</title>
|
|
<link rel="stylesheet" href="./login.css" type="text/css" />
|
|
</head>
|
|
|
|
<body>
|
|
<div id="area" style="text-align: center;">
|
|
<h1>Register</h1>
|
|
<!--input area-->
|
|
<form action = "./RegisterByDB.php" method="POST">
|
|
<input type="text" name="user" placeholder="Username" required>
|
|
<br><br>
|
|
<input type="password" name="pwd" placeholder="Password" required>
|
|
<br><br>
|
|
<label for="buyer" id="lb_buyer" onmousedown="implement(this)"
|
|
style="border-top-left-radius: 5px; border-bottom-left-radius: 5px;">Buyer</label>
|
|
<input type="radio" value="buyer" name="user_type" id="buyer" hidden required/>
|
|
<label for="seller" id="lb_seller" onmousedown="implement(this)"
|
|
style="border-top-right-radius: 5px; border-bottom-right-radius: 5px;">Seller</label>
|
|
<input type="radio" value="seller" name="user_type" id="seller" oninvalid="radio_alert()" hidden required/>
|
|
<p id="msg" style="color: red; font-size: small; padding: none; margin: none;"></p>
|
|
<button type="submit">Sign up</button>
|
|
</form>
|
|
<p style="font-size: small;">Already have an account? <a href="login.html" style="text-decoration: none;">Sign in</a></p>
|
|
</div>
|
|
|
|
<script>
|
|
//beautify label
|
|
function implement(tag){
|
|
document.getElementById("msg").innerHTML = "";
|
|
if(tag.id == "lb_buyer"){
|
|
document.getElementById("lb_seller").style = "border-top-right-radius: 5px; border-bottom-right-radius: 5px;";
|
|
tag.style="border-top-left-radius: 5px; border-bottom-left-radius: 5px; background-color: rgba(69, 67, 67, 0.6); color: white;";
|
|
}
|
|
if(tag.id == "lb_seller"){
|
|
document.getElementById("lb_buyer").style = "border-top-left-radius: 5px; border-bottom-left-radius: 5px;";
|
|
tag.style="border-top-right-radius: 5px; border-bottom-right-radius: 5px; background-color: rgba(69, 67, 67, 0.6); color: white;";
|
|
}
|
|
}
|
|
//alert if user choose nothing
|
|
function radio_alert(){
|
|
document.getElementById("lb_buyer").style = "border-top-left-radius: 5px; border-bottom-left-radius: 5px; background-color: pink;";
|
|
document.getElementById("lb_seller").style = "border-top-right-radius: 5px; border-bottom-right-radius: 5px; background-color: pink;";
|
|
document.getElementById("msg").innerHTML = "Please choose a user type!";
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |