DropDown value Comes on Text Field Using HTML and JS
<html>
<head>
<body bgcolor="#3399FF">
<center>
<h2>DropDown value on Text Field</h2>
<b>Select Value:</b><select id="DP" onchange="run()">
<!--Call run() function-->
<option>-select-</option>
<option value=
"value of 1 value of 1 value of 1 value of 1
value of 1 value of 1 value of 1 value of 1
value of 1 value of 1 value of 1 value of 1
value of 1 value of 1 value of 1 value of 1
value of 1 value of 1 value of 1 value of 1" title="value of 1" ">1</option>
<option value="value of 2" title="value of 2">2</option>
<option value="value of 3" title="value of 3">3</option>
<option value="value of 4" title="value of 4">4</option>
<option value="value of 5" title="value of 5">5</option>
</select><br><br>
<!--- Get the Selected value from Dropdown -->
<b>Dropdown text:</b>
<textarea rows="5" cols="66" id="tx" placeholder="get value
on option select" class="resizedTextbox" disabled="true">
</textarea>
<br>
</center>
</body>
</head>
</html>
<!------Java Script Starts here --->
<script>
function run() {
document.getElementById("tx").value = document.getElementById("DP").value;
alert(DP.value);
}
function up() {
//if (document.getElementById("srt").value != "") {
var dop = document.getElementById("tx").value;
//}
pop(dop);
}
</script>
<style>
body
{
width:80%;
margin-left:auto;
margin-right:auto;
}
resizedTextbox {width: 100px; height: 20px}
</style>
<head>
<body bgcolor="#3399FF">
<center>
<h2>DropDown value on Text Field</h2>
<b>Select Value:</b><select id="DP" onchange="run()">
<!--Call run() function-->
<option>-select-</option>
<option value=
"value of 1 value of 1 value of 1 value of 1
value of 1 value of 1 value of 1 value of 1
value of 1 value of 1 value of 1 value of 1
value of 1 value of 1 value of 1 value of 1
value of 1 value of 1 value of 1 value of 1" title="value of 1" ">1</option>
<option value="value of 2" title="value of 2">2</option>
<option value="value of 3" title="value of 3">3</option>
<option value="value of 4" title="value of 4">4</option>
<option value="value of 5" title="value of 5">5</option>
</select><br><br>
<!--- Get the Selected value from Dropdown -->
<b>Dropdown text:</b>
<textarea rows="5" cols="66" id="tx" placeholder="get value
on option select" class="resizedTextbox" disabled="true">
</textarea>
<br>
</center>
</body>
</head>
</html>
<!------Java Script Starts here --->
<script>
function run() {
document.getElementById("tx").value = document.getElementById("DP").value;
alert(DP.value);
}
function up() {
//if (document.getElementById("srt").value != "") {
var dop = document.getElementById("tx").value;
//}
pop(dop);
}
</script>
<style>
body
{
width:80%;
margin-left:auto;
margin-right:auto;
}
resizedTextbox {width: 100px; height: 20px}
</style>
Comments
Post a Comment