繁体   English   中英

我有 html 代码,里面有 JS,我有一个问题,提交按钮没有给我警报 window,你能纠正我的代码吗?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM