欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

select多選 multiple的使用示例

 更新時間:2014年06月16日 15:52:31   投稿:whsnow  
使用multiple可以實現(xiàn)select多選,本例將為大家介紹下select多選 multiple的使用,新手朋友們可以學(xué)習(xí)下
復(fù)制代碼 代碼如下:

<html>
<head>
<script type="text/javascript">
function 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;
}
function selectM()
{
var obj = document.getElementById("mySelect");
alert(obj.selectedIndex);

}
function checkselect(objname){
o = document.getElementById(objname);
t = document.getElementById("output");
var intvalue="";
for(i=0;i<o.length;i++){
if(o.options[i].selected){
intvalue+=o.options[i].value+",";
}
}
t.value=intvalue.substr(0,intvalue.length-1);
alert(intvalue);

}

</script>
</head>
<body>

<form>
<div id="selectOption" style='width:100px;height:50px;z-index:100;border:1px solid #0099FF;background:#cccccc;display:none;'>
<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="checkselect">
</div>
選中的項目:<input type="text" name="output">
<input id="lalla" type="button" onclick="showDiv(this.id)" value="選擇">
<br/>
</form>
<p>在您點擊 “選擇多個” 按鈕之前,請嘗試同時選取多個選項。在點擊 “選擇多個” 按鈕之后,請再試一次。</p>
</form>
</body>
</html>

相關(guān)文章

最新評論