You are on page 1of 1

<!

DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script>
function myfx() {
var objcbo = document.getElementById('selCourses');
var txt = document.getElementById('txtCourse');
//txt.value = objcbo.value; PF
//txt.value = objcbo.selectedIndex; 0
txt.value = objcbo.options[objcbo.selectedIndex].text;
}

</script>
</head>
<body>
<form>
<select id="selCourses">
<option value="PF">Programming Fundamental</option>
<option value="OOP">Object Oriented Programming</option>
<option value="DBMS">Database Management</option>
</select>
<input type="text" id="txtCourse" />
<input type="button" onclick="myfx()" />
</form>
</body>
</html>

You might also like