如何关闭弹出灯箱

时间:2015-05-18 10:31:09

标签: javascript ajax

这是我的代码。在这里,我使用'x'关闭弹出框。但我希望通过点击任何单选按钮来关闭它。

HTML:

<a href = "javascript:void()" onclick = "document.getElementById('light_<?php echo $vid;?>').style.display='block';document.getElementById('fade').style.display='block';"><span>Book now</a> <!--<div class="disp"><p>-->
<div id="light_<?php echo $vid;?>" class="white_content">
    <label>Email:</label>
    <?=$vehicle->Email; ?>
    </p><p>
    <label>Mobile:</label>
    <?=$vehicle->Mobile; ?></p>
    <p>
        <form id="form_<?php echo $vid;?>" name="form1" method="post" action="">
            <?php //echo $_REQUEST['email'];?>
            <p>
                <input type="hidden" name="vehicleid" value="<?php echo $vid;?>" id="vehicleid" />
                <label>
                    <input type="radio" name="RadioGroup1_<?php echo $vid;?> " value="1" id="bstatus<?php echo $vid;?>" onClick="idForm(<?php echo $vid;?>)" />
                    Conform
                </label>
                <br />
                <label>
                    <input type="radio" name="RadioGroup1<?php echo $vid;?>" value="0" id="bstatus1<?php echo $vid;?>" onClick="idForm(<?php echo $vid;?>)" />
                    Not Conform
                </label>
                <br />
            </p>
        </form>
        <a href = "javascript:void()" onclick = "document.getElementById('light_<?php echo $vid;?>').style.display='none';document.getElementById('fade').style.display='none'"><b>X</b></a>
    </div>
    <div id="fade" class="black_overlay"></div>
</div></span> 

JS:

function idForm(str) {
    var light = 'light_' + str;
    var fade = 'fade' + str; 
    document.getElementById(light).style.display = 'none'; 
    document.getElementById(fade).style.display = 'none';
    var confirmval = 'bstatus' + str;
    var unconfirmval = 'bstatus1' + str;
    if (document.getElementById(confirmval).checked) {
        var selectvalue = document.getElementById(confirmval).value;
    }

0 个答案:

没有答案