日期:2014-05-18  浏览次数:20691 次

html,jsp的简单问题,100分在线求教,请达人帮忙!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
最后的分数了,在线等答复,立刻给分.
请问如何用html或jsp可以做到在点击列表框和按钮时,使列表框中选择的内容和按钮的名字出现在textarea中.(我感觉只能用JSP实现,不知道对不对)
html代码如下,请高手帮写几句代码.谢谢先

<html>
<head>
<title> aa </title>
</head>
<body>

<form   action= "list.jsp "   method= "POST "> Field
<br>
<select   name= "field "   multiple>  
<option   value= "hk "> Hong   Kong </option>  
<option   value= "tw "   > Taiwan </option>  
<option   value= "cn "> China </option>  
<option   value= "us "> United   States </option>  
<option   value= "ca "> Canada </option>  
</select>  

<br>
<input   type= "Button "   value= "> ">  
<input   type= "Button "   value= "&lt; ">  
<input   type= "Button "   value= "> = ">
<input   type= "Button "   value= "&lt;= ">  
<input   type= "Button "   value= "= ">
<input   type= "Button "   value= "_ "   >  

<br>
<input   type= "Button "   value= "and ">
<input   type= "Button "   value= "or ">
<input   type= "Button "   value= "not ">
<input   type= "Button "   value= "is ">
<input   type= "Button "   value= "% ">


<br> SQL
<textarea   name= "comments "   cols= "40 "   rows= "4 ">  
</textarea>  

<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input   type= "Submit "   value= "应用 ">
<input   type= "Reset "   value= "置空 ">

</form>  

</body>
</html>

------解决方案--------------------
<html>
<head>
<script language= "javascript ">
function getname(initValue){
var s= " ";
if(document.form1.comments.value != " "){
s = document.form1.comments.value;
}
s += initValue + " ";
document.form1.comments.value = s;
}
function clearvlue(){
document.form1.comments.value = " ";
}
</script>
<title> aa </title>
</head>
<body>

<form name= "form1 " action= "list.jsp " method= "POST "> Field
<br>
<select name= "field " multiple onchange= "getname(this.value); ">
<option value= "hk "> Hong Kong </option>
<option value= "tw " > Taiwan </option>
<option value= "cn "> China </option>
<option value= "us "> United States </option>
<option value= "ca "> Canada </option>
</selec