简体   繁体   中英

Javascript confirm box

i try to use confirm box but it does not work after 'OK' pressing this is my confirm box

<script language="JavaScript">
{literal}
function confirmBox()
{
 var where_to= confirm("Silmek istediğinizden emin misiniz?");
 if (where_to== true)
     return true;
 else{
     alert("Silme işleminden vazgeçtiniz yönlendiriliyorsunuz");
     return false;
 }
}
{/literal}
</script>



 <form name="removeFortune" method="post" action="#">
    <table border="0" name="tableArticle">
     {foreach from=$articles value=article}
        <tr>
            <td><input type="checkbox" name="checkArticle[]" value="{$article.id}" /></td>
            <td>{$article.title}</td>
        </tr>
        {/foreach}
    </table>
    <input type="submit" onclick="confirmBox()" name="removeArticle" value="Sil" />
    <br /><br />

    {$deleteMessage}

</form>

If you want it to submit after pressing OK, you need to change 1 simple thing. Add a return

onclick="return confirmBox()"

Although I would say:

onsubmit="return confirmBox()"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM