Javascript ile html deki selected option index seçimi yapmak

    <select name=”country” id=”country”> <option value=”AF”>Afghanistan</option> <option value=”AL”>Albania</option> <option value=”ID”>Indonesia</option> <option value=”ZW”>Zimbabwe</option> </select> <script> function sec(i){ alert(i); var country = document.getElementById(“country”); country.options[i].setAttribute(“selected”, “selected”); } </script> <a href=”javascript:void(0);” onclick=”sec(3);” >sec</a>  

Devamı