简体   繁体   中英

Javascript & Combobox - Send the value of an item focused

I have a combobox with some values :

<select id="combo" name="my_combo" size="0" onchange="myFunction(this.getFocusedValue)"> 
    <option value="1">1 Mese</option>
    <option value="2">2 Mesi</option>
    <option value="3">3 Mesi</option>
    <option value="4">4 Mesi</option>
</select>

I want to translate that this.getFocusedValue on a real JavaScript code :)

How can I do this? Would be nice if this works on all browser (else i can use Jquery).

Thanks

SOLUTION

<select id="combo" name="my_combo" size="0" onchange="changeArticle(this.options[this.selectedIndex].value)">

this.selectedIndex;

Edit:

index = this.selectedIndex;
return this.options[index].value;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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