日期:2014-05-16 浏览次数:20368 次
<%=request("aa")%> <script language="javascript"> <!-- function watch_ini(){ // 初始 for(var i=0; i<arguments.length; i++){ var oOption=new Option(arguments[i],arguments[i]); document.getElementById("MySelect")[i]=oOption; } } function watch_add(f,prj_vlaue){ // 增加 var oOption=new Option(prj_vlaue,prj_vlaue); f.keywords[f.keywords.length]=oOption; } function watch_del(f){ // 删除 f.keywords.remove(f.keywords.selectedIndex); } //--> </script> <form name="form1" method="get" action=""> <table width="404" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="400" height="25" ><div id="prjname" ></div></td> </tr> <tr> <select id="MySelect" name="keywords" size="10" ></select> </tr> </table> <input type="submit" value="提交" name="add" /> <input type="button" value="删除" onclick="watch_del(this.form);" /> </form>
function watch_add(f, prj_value) { f.keywords.add(new Option(prj_value, prj_value), null); }
------解决方案--------------------
<form name="form1" method="get" action="">
<table width="404" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="400" height="25" ><div id="prjname" ></div></td>
</tr>
<tr>
<select id="MySelect" name="keywords" size="10" ></select>
</tr>
</table>
<input type="submit" value="提交" name="add" />
<input type="button" value="删除" onclick="watch_del(this.form);" />
</form>
<script language="javascript">
<!--
function watch_ini(){ // 初始
for(var i=0; i<arguments.length; i++){
var oOption=new Option(arguments[i],arguments[i]);
document.getElementById("MySelect")[i]=oOption;
}
}
function watch_add(f,prj_value){ // 增加
f.add(new Option(prj_value, prj_value));
}
var test = '<%=request("aa")%>';
var obj = document.getElementById('MySelect');
watch_add(obj, test)
function watch_del(f){ // 删除
f.keywords.remove(f.keywords.selectedIndex);
}
//-->
</script>
这个意思?