Home >Web Front-end >JS Tutorial >How to get the value of the select drop-down box (option has no and value attributes)_javascript skills

How to get the value of the select drop-down box (option has no and value attributes)_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:16:331311browse

How to get the value of the select drop-down box:
1. When the option of the drop-down box has no value attribute

Copy the code The code is as follows:






<script> <br>window.onload = funciton(){ <br>var param = document.getElementById("param1"); <br>param.onchange = getParam(){ <br>var selectIndex = param.selectIndex; //Get the index number of the option <br>var text = param.options[selectIndex].text; <br></script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn