getting value of selected list item in a textarea

J

junoon

hi all,

I am trying to get the values of the item selected in a select list box
into a textarea, but the code is not working....Where am i going
wrong????

whenever i click on any item in the list, the corresponding value for
it will get displayed in the text area.....

Also, is there a way to get data from a text file into the textarea,
when i select an item in the list.

*****************************************
<html>
<head>
<script language="javascript">
function getit(){
var data='...\n';
if(data.value){
data=document.form1.sel1.options[document.form1.sel1.SelectedIndex].value+"....\n";

document.form1.tex1.value=data;
}
}
</script>
</head>

<body>
<form name="form1" onsubmit="getit(); return false">
<table>
<tr><td>Issue: </td>
<td><select name="sel1" size= "3">
<option value="pc problem">error 0680
<option value="modem problem">error 0633
<option value="network problem">error 0721
</select>
</td>
<td>Resolution: </td>
<td><textarea name="tex1" rows=7 cols=30 wrap=virtual></textarea>
</td>
</tr>

<TR>
<TD COLSPAN=2 ALIGN=center>
<INPUT TYPE=submit VALUE="Submit form"><BR>
<INPUT TYPE=reset>
</TD>
</TR>
</table>
</form>
</body>
</html>

Rgds,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top