js如何實(shí)現(xiàn)點(diǎn)擊按鈕后彈出驗(yàn)證框
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
![]() ![]() <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>驗(yàn)證框示例</title> <script> function validateInput() { const correctAnswer = "1234"; // 假設(shè)正確答案是 1234 const userInput = prompt("請輸入密碼:"); if (userInput === correctAnswer) { alert("驗(yàn)證通過,繼續(xù)進(jìn)行!"); // 在這里可以繼續(xù)進(jìn)行其他操作 } else { alert("輸入錯(cuò)誤,請重試!"); } } </script> </head> <body> <button onclick="validateInput()">點(diǎn)擊驗(yàn)證</button> </body> </html> ? 該文章在 2025/2/25 15:02:05 編輯過 |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |