<html>
<body>
<form action="form-action.php">
E-mail: <input type="email" id="myEmail" name="usremail" required>
<input type="submit">
</form>
<p>点击 "点我" 按钮查看 email 字段是否为表单的必填部分。</p>
<button onclick="myFunction()">点我</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myEmail").required;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>