复制代码代码如下:
<html>
<adal>
<script type = "text / javascript">
fonction 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;
}
fonction selectm ()
{
var obj = document.getElementById ("mySelect");
alert (obj.selectedIndex);
}
Fonction CheckSelect (objname) {
o = document.getElementById (objname);
t = document.getElementById ("sortie");
var intValue = "";
pour (i = 0; i <o.length; i ++) {
if (o.options [i] .selected) {
intValue + = o.options [i] .value + ",";
}
}
t.value = intValue.substr (0, intValue.length-1);
alerte (intValue);
}
</cript>
</ head>
<body>
<formulaire
<div id = "selectOption" style = 'width: 100px; hauteur: 50px; z-index: 100; bordure: 1px solide # 0099ff; arrière-plan: #cccccc; affichage: aucun;'>
<select id = "mySelect" multiple = "multiple" size = "4">
<Option Value = '苹果'> 苹果 </ Option>
<Option Value = '桃子'> 桃子 </ Option>
<Option Value = '香蕉'> 香蕉 </ Option>
<Option Value = '桔子'> 桔子 </ Option>
</lect>
<entrée type = "bouton" onclick = "checkSelect ('mySelect')" value = "checkSelect">
</div>
选中的项目 : <input type = "text" name = "output">
<input id = "lalla" type = "bouton" onclick = "showDiv (this.id)" value = "选择">
<br/>
</ form>
<p> 在您点击 “选择多个” 按钮之前 , 请尝试同时选取多个选项。在点击 请尝试同时选取多个选项。在点击 选择多个 选择多个 选择多个 按钮之后 , 请再试一次。 </p>
</ form>
</docy>
</html>