Хотел узнать как можно сделать следующее:
Надо чтобы при выборе одной из опций, отсылало на форму этой опции, в то же время убирая другие формы.
Данный код JavaScript не работает. Почему ?
Буду рад если кто поможет с кодом, как можно его модифицировать и укоротить для получения такого же результата.
document.getElementById("createcompany").onselect = function() {
document.getElementById("create_company_form").style.display = "block";
document.getElementById("remove_company_form").style.display = "none";
document.getElementById("update_company_form").style.display = "none";
document.getElementById("get_company_with_id_form").style.display = "none";
document.getElementById("getallcompanies_form").style.display = "none";
document.getElementById("create_customer_form").style.display = "none";
document.getElementById("remove_customer_form_byid").style.display = "none";
document.getElementById("remove_customer_form_byname").style.display = "none";
document.getElementById("update_customer_form").style.display = "none";
document.getElementById("get_cust_with_id_form").style.display = "none";
document.getElementById("getallcustomers_form").style.display = "none";
}
<select size = 11>
<option disabled> Menu</option>
<option id = "createcompany">Create company</option>
<option id = "remove">Remove company</option>
<option id = "update">Update company</option>
<option id = "get_company_with_id">Get company by id</option>
<option id = "getallcompanies">Get all companies</option>
<option id = "create_customer">Create customer</option>
<option id = "remove_customer_by_id">Remove customer by id</option>
<option id = "remove_customer_by_name">Remove customer by name</option>
<option id = "update_customer">Update customer</option>
<option id = "get_cust_with_id">Get customer by id</option>
<option id = "getallcustomers">Get all customers</option>
</select>