復(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> 
<select multiple="multiple" size="4"> 
<option value='蘋果'>蘋果</option> 
<option value='桃子'>桃子</option> 
<option value='香蕉'>香蕉</option> 
<option value='桔子'>桔子</option> 
</select> 
<input type="button" value="checkselect"> 
</div> 
選中的項(xiàng)目:<input type="text"> 
<input type="button" value="選擇"> 
<br/>
</form> 
<p>在您點(diǎn)擊 “選擇多個(gè)” 按鈕之前,請(qǐng)嘗試同時(shí)選取多個(gè)選項(xiàng)。在點(diǎn)擊 “選擇多個(gè)” 按鈕之后,請(qǐng)?jiān)僭囈淮巍?lt;/p>
</form> 
</body> 
</html> 
新聞熱點(diǎn)
疑難解答
圖片精選