Hello everyone, the task is to write a condition on javascript for the situation when the user selects a group, presses the "forward" button and depending on his choice one or another page (for example, a list of this group) pulls up.
I perfectly understand the logic of the work, but due to lack of experience, the problem is this: I don’t know how to pull up the group’s value (I tried the ID, for some reason it worked out, I spent a lot of time and finally decided to write here.) And what value the variable should take , if variable var == 0 for the drop-down list (can it take such a value at all or should it be null)
Please write the correct version and, if it is not difficult, CLEAR what and how , reviewed a bunch of videos, a bunch of articles, found an option only like this:
var val = getElementById('one').value; if val == 0 document.location.href = spisokgryppi.html '; else alert("Данный код в баззе не хранится!");) <!DOCTYPE> <HTML> <HEAD> <meta charset="utf-8"> <script type="text/javascript"> -- </script> </head> <body> <form> <h4>Номер группы</h4> <select> <option disabled>Номер группы</option> <option id = "one" >07-16</option> <option id = "two" >06-14</option> <option id = "three">06-15</option> </select> </form> <form 1> <input type="submit" value="Вперед"> </form 1> </body> </HTML>