<div class="codetitle"> <span><a style="CURSOR: pointer" data="7801" class="copybut" id="copybut7801" onclick="doCopy('code7801')"><u>複製程式碼</u></a></span>如下程式碼:</div> <div class="codebody" id="code7801"> <br>/W3C//DTD HTML 4.0過渡//EN"> <br> <br> <br>新文件 <br><meta name="Generator" content="EditPlus"> <br> <br><meta name="Keywords" content=""> <br> <br>頭> <br> <br><br> <br><!-- <BR>function checkselect(objname){ <BR>o = document.getElementById(objname); <BR>t = document.getElementById("output"); <BR>var 計數=0; <BR>var intvalue=""; <BR>for(i=0;i<o.length;i ){ <BR>if( o.options[i].selected){ <BR>intvalue =o.options[i].value ","; <BR>計數; <BR>} <BR>} <BR>t.value=intvalue.substr (0,intvalue.length-1); <BR>警報(計數); <br><br>} <BR>//--> <br>腳本> <br><select name="objsel" size="8"> <br>請選擇<br>測試一<br>測試二<br>測試三<br><option value="4">測試四<br> </option> <option value="5">測試五<br> </option></select> <br><input type=" button" onclick="checkselect('objsel');"> <br> 選取的項目:<input type="text" name="output"> <br>身體> <br> <br> </div>