开发者

Fetch select list value in javascript

I have the select list in the html page as follows:

<select onchange="storePolishType('/p/','b',this.value );" class="drop_down1">

<option value="12">Margin2&ndash;Sawed Margin </option>     
<option value="13">Polished-Sawed Back Polished </option>       
<option value="13">Polished-Steeled Back Polished </option>     
<option value="13">Polished&ndash;All Polished </option>        
<option selected="selected" value="11">Sawed-All Polished </option>     

</select>

I want to pass value e.g. 11 and value between option tag e.g. "Sawed-All Polishe开发者_开发技巧d" to the storePolishType javascript function. I don't know how to pass this two values. please help me.


Basically, what you want is:

<select onchange="storePolishType(this.value,this.options[this.selectedIndex].text)" class="drop_down1">

this will pas the value (eg, 11) and the text (eg, "Sawed-All Polished ") to a function storePolishType

live example: http://jsfiddle.net/QFtPG/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜