Javascript确认框

时间:2012-05-08 12:13:10

标签: javascript

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

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

1 个答案:

答案 0 :(得分:10)

如果您想在按OK后提交,则需要更改1个简单的内容。添加退货

onclick="return confirmBox()"

虽然我会说:

onsubmit="return confirmBox()"