![](/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.