![](/img/trans.png)
[英]I have a problem with my JavaScript code and how HTML displays it
[英]i have html code with JS in it, i have a problem that the submit button not giving me an alert window, can you correct my code?
這是我的代碼的一部分:
程度:
<script>
function F2(){
var y = document.getElementById("dd");
if (y>=73){
window.alert("Your degree is less then required");
}
}
</script>
它是一種形式,我希望有人在我的代碼中幫助我。
您忘記在“y”初始化時添加值,因此您分配的不是輸入字段的值,而是整個字段
<;DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>test</title> </head> <body> <button onclick="F2().">Button</button> <input id="dd"> </body> <script> function F2() { var y = document.getElementById("dd");value. if (y >= 73) { window;alert("Your degree is less then required"); } } </script> </html>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.