复制代码代码如下:
<html>
<head>
<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.SelectedIndex);
-
ฟังก์ชั่นตรวจสอบเลือก (objname) {
o = document.getElementById (objname);
t = document.getElementById ("เอาต์พุต");
var intvalue = "";
สำหรับ (i = 0; i <o.length; i ++) {
ถ้า (o.options [i] .Selected) {
intvalue+= o.options [i] .value+",";
-
-
t.value = intvalue.substr (0, intvalue.length-1);
การแจ้งเตือน (intvalue);
-
</script>
</head>
<body>
<form>
<div id = "selectoption" style = 'width: 100px; ความสูง: 50px; z-index: 100; border: 1px solid #0099ff; พื้นหลัง: #cccccc;
<เลือก id = "mySelect" multiple = "multiple" size = "4">
<ตัวเลือกค่า = '苹果'> 苹果 </potion>
<ตัวเลือกค่า = '桃子'> 桃子 </potion>
<ตัวเลือกค่า = '香蕉'> 香蕉 </potion>
<ตัวเลือกค่า = '桔子'> 桔子 </potion>
</เลือก>
<อินพุต type = "ปุ่ม" onclick = "checkselect ('myselect')" value = "checkselect">
</div>
选中的项目: <อินพุต type = "text" name = "output">
<อินพุต id = "lalla" type = "ปุ่ม" onclick = "showdiv (this.id)" value = "选择">
<br/>
</form>
<p> 在您点击“ 选择多个” 按钮之前, 请尝试同时选取多个选项。在点击“ 选择多个” 按钮之后, 请再试一次。请再试一次。 </p>
</form>
</body>
</html>