复制代码代码如下:
<html>
<голова>
<script type = "text/javascript">
Функция 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;
}
функция selectm ()
{
var obj = document.getElementbyId ("mySelect");
предупреждение (obj.sectedIndex);
}
Function CheckSelect (objName) {
o = document.getElementById (objName);
t = document.getElementbyId ("output");
var intvalue = "";
for (i = 0; i <o.length; i ++) {
if (o.options [i]. Selection) {
intValue+= o.Options [i] .value+",";
}
}
t.value = intvalue.substr (0, intvalue.length-1);
предупреждение (Intvalue);
}
</script>
</head>
<тело>
<форма>
<div id = "selectOption" style = 'width: 100px; высота: 50px; z-index: 100; граница: 1px solid #0099ff; фон: #ccccc; display: none;'>
<select id = "mySelect" multy = "multy" size = "4">
<option value = '苹果'> 苹果 </option>
<option value = '桃子'> 桃子 </option>
<option value = '香蕉'> 香蕉 </option>
<option value = '桔子'> 桔子 </option>
</select>
<input type = "button" onclick = "CheckSelect ('mySelect')" value = "checkSelect">
</div>
选中的项目 : <input type = "text" name = "output">
<input id = "lalla" type = "кнопка" onclick = "showdiv (this.id)" value = "选择">
<br/>
</form>
<p> 在您点击 «选择多个» 按钮之前 , 请尝试同时选取多个选项。在点击 选择多个 选择多个 按钮之后 , 请再试一次。 </p>
</form>
</body>
</html>