<html>
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />
<title>无标题文档</title>
</head>
<script language="javascript">
function getValue()
{
var s = ""
for(var i=0i<form1.ss.options.lengthi++)
{
if(form1.ss.options[i].selected)
{
s+=form1.ss.options[i].value
}
}
alert(s)
}
</script>
<body>
<form id="form1" name="form1" method="post" action="">
请选择:
<select id="ss" name="ss" size="5" multiple="multiple">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
<br>
<input type="button" name="Submit" value="提交" onclick="getValue()" />
</form>
</body>
</html>
**************************补充**********************
修改select标签的size属性,把它的值改为1即可。
<select multiple="multiple"><option>...</option>
...
</select>
按住ctrl点击左键即可多选
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)