0

任意のチェックボックスを選択できますが、チェックボックスを選択すると、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;
        }
    }
}
4

2 に答える 2