被鸿蒙的IDE的环境耽搁了老久
写了一些有意思的
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>What do you wwant to eat?</title>
<link rel="stylesheet" href="登录.css">
</head>
<body>
<div class="login">
<h1>Login</h1>
<form action="./首页.html">
<!-- <label for="username">用户名</label> -->
<input type="text" id="uname" value="" placeholder="你想买什么好吃的?请输入:"/><br>
<input type="password" id="pwd" value="" placeholder="输入大致金额:"/><br>
<input type="submit" id="but" value="登录" onclick="return checkuser()"/>
<!-- 返回了true就会打开页面 -->
</form>
</div>
</body>
<script type="text/javascript">
function getValue(id) {
return document.getElementById(id).value;
// 查找元素
}
function checkuser() {
if(getValue('uname') == "小孩子才做选择,我全都要!" && getValue('pwd') == "123") {
return true;
}else {
alert("呐,给你一只烤鸡腿一大把炸串一碗新疆米粉一杯椰汁、一盆捞汁海鲜、一盆新鲜饭后猕猴桃~")
return false;
}
}
</script>
</html>