在 JavaScript 中获取选择列表值
我在 html 页面中有如下选择列表:
<select onchange="storePolishType('/p/','b',this.value );" class="drop_down1">
<option value="12">Margin2–Sawed Margin </option>
<option value="13">Polished-Sawed Back Polished </option>
<option value="13">Polished-Steeled Back Polished </option>
<option value="13">Polished–All Polished </option>
<option selected="selected" value="11">Sawed-All Polished </option>
</select>
我想将值(例如 11)和选项标记之间的值(例如“Sawed-All Polished”)传递给 storePolishType 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–Sawed Margin </option>
<option value="13">Polished-Sawed Back Polished </option>
<option value="13">Polished-Steeled Back Polished </option>
<option value="13">Polished–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 Polished" to the storePolishType javascript function. I don't know how to pass this two values.
please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上,您想要的是:
这会将值(例如 11)和文本(例如“Sawed-All Polished”)传递给函数
storePolishType
实时示例:http://jsfiddle.net/QFtPG/
Basically, what you want is:
this will pas the value (eg, 11) and the text (eg, "Sawed-All Polished ") to a function
storePolishType
live example: http://jsfiddle.net/QFtPG/