<html>
<body>
<form id="myForm"><select name="select">
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option id="o3" value="3">Default selected Option</option>
<script language="JavaScript">
document.getElementById("o3").defaultSelected = true;
var n = document.getElementById("o3").innerText;
function function1() {
alert('Default selected Option label:\n'+'"'+n+'"');
document.getElementById("myForm").reset();
}
</script>
<option value="4">Item 4</option>
<option value="5">Item 5</option>
</select>
</form>
<input type="button" value='Click here' onclick="function1();">
</body>
</html>
|