我可以选择任何一个复选框,但是当我选择复选框时,我显示 div 的时间更长,这里是复选框:
<INPUT type=CHECKBOX id='IP_3820' IP='12.12.12.12' PORT='5060' onclick='javascript: ipSelected(this)' value='3820' >12.12.12.12
<br />
<INPUT type=CHECKBOX id='IP_3822' IP='12.12.12.13' PORT='5060' onclick='javascript: ipSelected(this)' value='3822' >12.12.12.13
这个 div 我想显示为选中任何一个复选框:
<div id='vp_3822' style='float:right;display:none;'>
<input type='radio' name='3822' id='IP_none' value='none' /> NONE /
<input type='radio' name='3822' id='g729' value='g729' />g729/
<input type='radio' name='3822' id='ulaw' value='ulaw' checked='checked' />ulaw
</div><br />
这是功能:
function ipSelected(el){
if(el.checked){
document.getElementById("IP_none").checked=false;
if(last_ip_id!="" && last_ip_id!=el.id && ( document.getElementById('system').value=='voipswitch' || document.getElementById('system').value=='asterisk' || document.getElementById('system').value=='ipsmarx')){
try { document.getElementById(last_ip_id).checked=false;}catch(e){}
}
last_ip_id = el.id;
document.getElementById("vp_" + el.value).style.display="block";
// Set destination value
if((document.getElementById('system').value=='voipswitch') || (document.getElementById('system').value=='asterisk' || document.getElementById('system').value=='ipsmarx')){
document.getElementById('dest_span').innerHTML = "@" + el.getAttribute("IP") + ":" + el.getAttribute("PORT");
document.theForm.idiplist.value = el.value;
}
}
}