这是我的代码
<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>
在此代码中,我想在用户点击取消确认警报时运行该添加。有人帮忙吗?谢谢提前..
答案 0 :(得分: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>