select 多选

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<head>

<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>

<title>select多选</title>

<scriptlanguage="javascript">

<!--

functionshow(){

varsel=document.forms["form1"].s1;

vars="";

for(vari=0;i<sel.options.length;i++){

if(sel.options[i].selected)

s+=sel.options[i].innerText+",";

}

if(s!="")s=s.substr(0,s.length-1);

alert(s);

}

-->

</script>

</head>

<body>

<formname="form1"id="form1">

<divwidth="300"height="160"border="1">

<selectname="s1"style="WIDTH:100px"multiple="multiple"size=15id="list">

<option>XHTML</option>

<option>CSS</option>

<option>JAVASCRIPT</option>

<option>XML</option>

<option>PHP</option>

<option>C#</option>

<option>JAVASCRIPT</option>

<option>XML</option>

<option>PHP</option>

<option>C#</option>

<option>JAVASCRIPT</option>

<option>XML</option>

<option>PHP</option>

<option>C#</option>

<option>JAVASCRIPT</option>

<option>XML</option>

<option>PHP</option>

<option>C#</option>

<option>JAVA</option>

<option>C++</option>

<option>PERL</option>

</select>

</div>

<inputname="button"type="button"onclick="show()"value="ShowOptionText"/>

</form>

</body>

</html>

相关推荐