复制代码代码如下::
<html>
<kopf>
<script type = "text/javaScript">
Funktion showdiv (id) {
document.getElementById ("Selectoption"). style.display = "block";
document.getElementById ("Selectoption"). style.position = "Absolute";
document.getElementById ("selectoption"). style.top = document.getElementById (ID) .Offsettop+25;
document.getElementById ("selectoption"). style.left = document.getElementById (ID) .OffsetLeft+20;
}
Funktion selectM ()
{
var obj = document.getElementById ("mySelect");
Alert (obj.seltedindex);
}
Funktionsprüfte (objname) {
o = document.getElementById (objname);
t = document.getElementById ("output");
var intvalue = "";
für (i = 0; i <o.Length; i ++) {
if (O.Options [i] .Selected) {
intValue+= O.Options [i] .Value+",";
}
}
T.Value = intValue.substr (0, intValue.Length-1);
Alarm (intValue);
}
</script>
</head>
<body>
<form>
<div id = "selectoption" style = 'width: 100px; Höhe: 50px; Z-Index: 100; Rand: 1PX Solid #0099ff; Hintergrund: #ccccc; Anzeige: Keine;'>
<select id = "mySelect" multiple = "multiple" size = "4">
<Option Value = '苹果'> 苹果 </option>
<Option Value = '桃子'> 桃子 </option>
<Option Value = '香蕉'> 香蕉 </option>
<Option Value = '桔子'> 桔子 </option>
</select>
<input type = "button" onclick = "CheckSelect ('mySelect')" value = "pechseselect">
</div>
选中的项目 : <Eingabe type = "text" name = "output">
<input id = "lalla" type = "button" onclick = "showdiv (this.id)" value = "选择">
<br/>
</form>
<p> 在您点击 "选择多个" 按钮之前 , 请尝试同时选取多个选项。在点击 "选择多个" 按钮之后 , 请再试一次。 </p>
</form>
</body>
</html>