嗯,我正在嘗試如何驗證密碼,如果它們匹配,我多次測試並嘗試更改它的位但它仍然不會說已驗證或未驗證。 ..我很抱歉,如果我沒有看到明顯的東西,我也嘗試在網上搜索一下,但我真的需要做到這一點。非常感謝幫助。檢查密碼是否匹配不起作用
<html>
<head>
<title>FA3</title>
</head>
<body>
<style type="text/css">
.font
{
font-family:Helvetica Neue;
text-align:center
}
</style>
<div class="font">
<h2>Verify Password</h2>
Type Password : <input type="text" id="first">
<br>
Retype Password : <input type="text" id="second">
<hr>
<button onclick="verify()">Submit</button>
<br>
<p id="result">Your Password is</p>
</div>
<script>
function verify(){
var t = document.getElementbyId("first").value;
var r = document.getElementbyId("second").value;
if (t==r){
document.getElementById("result").innerHTML ="Verified"
}
else{
document.getElementById("result").innerHTML ="Not Verified"
}}
</script>
</body>
</html>
(偏離主題,但有點相關)您可能希望使用更「適當的」類型的密碼,而不是隻使用「文本」字段。 – Scar