How do I get the value of option of the select drop down box without and with a value attribute


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


<select id="param1">
<option> Student id </option>
<option> The name </option>
<option> age </option>
</seclect>
<script>
window.onload = funciton(){
var param = document.getElementById("param1");
param.onchange = getParam(){
var text = param.value;
}
}
</script>

2. When the option in the drop-down box has a value attribute


<select id="param1">
<option> Student id </option>
<option> The name </option>
<option> age </option>
</seclect>
<script>
window.onload = funciton(){
var param = document.getElementById("param1");
param.onchange = getParam(){
var selectIndex = param.selectIndex; //Gets the lead number of the option
var text = param.options[selectIndex].text;
</script>