2

我尝试使用确认框,但按“确定”后它不起作用,这是我的确认框

<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>
4

1 回答 1

10

如果您希望它在按 OK 后提交,您需要更改 1 个简单的事情。添加退货

onclick="return confirmBox()"

虽然我会说:

onsubmit="return confirmBox()"
于 2012-05-08T12:17:41.030 回答