-3

这是我的代码

<script type="text/javascript">
    function validate()
    {
        var con=confirm("Are You Want to add More Packages");
        if(con==true)
        {
            var radio1=document.getElementById('first_radio');
            if(radio1.checked==true)
            {

                var a=document.getElementById('total').value;
                b=(parseInt(a)+parseInt(a));
                document.getElementById('total').value=b;
                var c=confirm("Are You Want to add More Packages")
                if(c==true)
                {

                }
            }
        }
        else
        {
            alert("you clicked Cancel");
        }  
    }
</script>

在此代码中,我想在用户单击确认警报中的取消之前运行该添加。有人帮忙吗?提前谢谢..

4

1 回答 1

0

尝试这个,

<script type="text/javascript">
    function validate()
    {
        var con=confirm("Are You Want to add More Packages");
        if(con==true)
        {
            var radio1=document.getElementById('first_radio');
            if(radio1.checked==true)
            {
                var a=document.getElementById('total').value;
                b=(parseInt(a)+parseInt(a));
                document.getElementById('total').value=b;
                validate();// call this function again from here
            }
        }
        else
        {
            alert("you clicked Cancel");
        }  
    }
</script>
于 2013-07-10T07:27:52.023 回答