var tmp = '';
param_extension_moteur = document.getElementById("select1");
for (var i = 0; i < param_extension_moteur.size; i++) {
if (param_extension_moteur[i].checked==true) {
tmp = param_extension_moteur[i].value;
}
}
return tmp;
param_extension_moteur = document.getElementById("select1");
for (var i = 0; i < param_extension_moteur.size; i++) {
if (param_extension_moteur[i].checked==true) {
tmp = param_extension_moteur[i].value;
}
}
return tmp;
<TITLE>b </TITLE>
<script>
function $(sId){
return document.getElementById(sId);
}
var arrSel = new Array();
function aaa(){
var oSel = $('select1');
for(var i=0;i<oSel.options.length;i++){
if(oSel.options[i].selected){
arrSel.push(oSel.options[i].text);
}
}
alert(arrSel.toString());
}
</script>
</HEAD> <BODY>
<table border='1'>
<tr>
<td onclick="aaa()">
aaa
</td>
</tr>
</table>
<select id="select1" size="4" multiple>
<option value="111">111</option>
<option value="222">222</option>
<option value="333">333</option>
<option value="444">444</option></select> </BODY>
</HTML>
function aaa()
{
var obj=document.getElementById ('select1');
var str="";
for(var i=0;i<obj.size;i++)
{
if(obj[i].selected==true)
{
str=str+","+obj[i].value;
}
}
//alert(str);
}
function aaa()
{
var obj=document.getElementById ('select1');
var str="";
for(var i=0;i<obj.size;i++)
{
if(obj[i].selected==true)
{
str=str+","+obj[i].value;
}
}
alert(str);
}
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script>
function OnSelectChange(selecter){
alert(selecter.options[selecter.selectedIndex].value)
}
</script>
</HEAD><BODY>
<select id="select1" size="7" multiple onchange="OnSelectChange(this);">
<option value="供需发布">供需发布</option>
<option value="人才信息">人才信息</option>
<option value="养猪技术">养猪技术</option>
<option value="养猪培训">养猪培训</option>
<option value="养猪文化">养猪文化</option>
<option value="养猪资讯">养猪资讯</option>
<option value="猪场经营">猪场经营</option>
</select></BODY>
</HTML>
随手写了个,参考一下吧