日期:2014-05-16  浏览次数:20329 次

请教一个字段数据写入下拉组件的问题
access数据库的一个备注型字段是用回车形成的几行文本,怎么在网页中用javascript把每一行写入select组件作为option项?

------解决方案--------------------
<select name= "select ">
<%
data= "111 "+chr(10)+ "222 "+chr(10)+ "333 " '这个为备注字段中的内容
tmp=split(data,chr(10))
for i=0 to ubound(tmp)
response.Write( " <option> "&tmp(i)& " </option> ")
next
%>
</select>
------解决方案--------------------
动态增加Select项
document.myForm.mySelect.length++;
document.myForm.mySelect.options[document.myForm.mySelect.length - 1].text = "3 ";
document.myForm.mySelect.options[document.myForm.mySelect.length - 1].value = "Third Choice ";