<%--
Created by IntelliJ IDEA.
User: 26945
Date: 2024/10/23
Time: 16:57
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<link rel="stylesheet" href="static/plugins/bootstrap/css/bootstrap.min.css">
</head>
<body>
<div style="width: 500px;height:300px; margin: 200px auto; box-shadow: 0px 1px 10px rgba(26, 26, 26, 0.1);padding: 0 20px">
<h1>用户登录</h1>
<form method="post" >
<div class="form-group">
<label for="username">用户名</label>
<input type="text" class="form-control" id="username">
</div>
<div class="form-group">
<label for="password">密码</label>
<input type="password" class="form-control" id="password">
</div>
<button type="submit" class="btn btn-primary" id="loginBtn">登录</button>
</form>
</div>
<script src="static/js/jquery-3.6.0.min.js"></script>
<script src="static/plugins/bootstrap/js/bootstrap.min.js"></script>
<script>
document.getElementById('loginBtn').addEventListener('click', function (){
var username = document.getElementById('username').value
var password = document.getElementById('password').value
})
</script>
</body>
</html>
标签:username,触发,document,getElementById,value,点击,事件,var,password
From: https://www.cnblogs.com/cloud-2-jane/p/18497885