zoukankan      html  css  js  c++  java
  • confirm example

    Javascript Confirm Form Submission
    By Nannette Thacker - 11/17/2000 Updated: 2/15/2001

    Oft times you may wish to have the user confirm, before they process a form's action. For instance, clicking the button may activate a deletion process which you wish to have the user confirm before proceeding.

    This code allows your users to confirm whether they wish to proceed when processing a form with serious consequences, such as DELETE.

    You may also use the confirmSubmit() function for confirming whether to proceed with a hyperlink and you may assign it to a single button on a form. For instance, you only want to confirm the Delete button, not the Submit button.

    Hyperlink example:

    delete

    <a onclick="return confirmSubmit()"
    href="/articles/articles/javascript/confirmsubmit.asp?ID=<%=siteID%>">
    delete</a><P>

    The below example shows how to tie the confirmation to a single button on a form.

    <form method="POST"
    action="/articles/articles/javascript/confirmsubmit.asp?ID=<%=siteID%>"
    id="submitform" name="submitform">

    <input type="Submit" name="Submit" value="Submit">

    <input type="Submit" name="Delete" value="Delete"
    onClick="return confirmSubmit()">

    </form>
    </b>
    <p>

    The following example shows how to confirm the submission of the entire form from within the FORM tag. The form calls itself in this example, but in yours, it would likely call the processing page. Here is the code to confirm a form submission:

    Inventory:

    Shoes Socks

    <script LANGUAGE="JavaScript">
    <!--
    // Nannette Thacker http://www.shiningstar.net
    function confirmSubmit()
    {
    var agree=confirm("Are you sure you wish to continue?");
    if (agree)
    return true ;
    else
    return false ;
    }
    // -->
    </script>

    For ASP fun, I have inserted the verbiage "Deleted" dependent upon the selection. Here is the form code for those using ASP. The "&ID=AW" or "&ID=<%=siteID%>" code in the "action" is used by this web site and is not needed by your code. Those using plain Javascript can view the source code:

  • 相关阅读:
    python手写神经网络实现识别手写数字
    记录:tensoflow改错TypeError: Cannot interpret feed_dict key as Tensor: Can not convert a float into a Te
    6 TensorFlow实现cnn识别手写数字
    记录:python读取excel文件
    matlab手写神经网络实现识别手写数字
    把当前文件夹的xlsx或xls文件合并到一个excel文件中的不同sheet中
    Mac卸载go
    vue中axios的post和get请求示例
    vue配置请求拦截器和响应拦截器
    vue中main.js配置后端请求地址
  • 原文地址:https://www.cnblogs.com/binlyzhuo/p/1251124.html
Copyright © 2011-2022 走看看