<script type="text/javascript"> function setOptions(chosen) { var izbor = document.form3.celik; izbor.options.length = 0; if (chosen == " ") { izbor.options[izbor.options.length] = new Option('choose',' '); } if (chosen == "okc") { izbor.options[izbor.options.length] = new Option('C0270','C0270'); izbor.options[izbor.options.length] = new Option('C0370','C0370'); } if (chosen == "pc") { izbor.options[izbor.options.length] = new Option('C1330','C1330'); izbor.options[izbor.options.length] = new Option('C1530','C1530'); } if (chosen == "cc") { izbor.options[izbor.options.length] = new Option('C1120','C1120'); izbor.options[izbor.options.length] = new Option('C1220','C1220'); } } </script> <select name="vrsta" size="1" onchange="setOptions(document.form3.vrsta.options [document.form3.vrsta.selectedIndex].value);"> <option value=" " selected="selected"> </option> <option value="okc">Opsti konstrukcijski celici</option> <option value="pc">Poboljsani celici</option> <option value="cc">Cementirani celici</option> </select> <select name="celik" size="1"> <option value=" " selected="selected">Izabrati prvo vrstu</option> </select> <input type="button" value=" ok " onclick="form3.ans15.value(document.form3.vrsta.options[document.form3.vrsta.selectedIndex].value);" /> <input type="type" "number" value="" name="ans15" size="9" /> <input type="type" "number" value="" name="ans14" size="9" /> Code (markup): I dont know how to write something in ans15 and ans14 onclick of button Example...if user selects new Option('C0270','C0270') and clicks on button it should write something in ans15 and ans14 I tried <input type="button" value=" ok " onclick="form3.ans15.value(document.form3.vrsta.options[document.form3.vrsta.selectedIndex].value);" /> but it is not good...