JSP is combined with JavaScript to handle confirm validation to pass parameters to another page __js

Source: Internet
Author: User

The purpose is to remove a series of data from the database

At the end of each row there is a delete item

However, the deletion requires the user to confirm whether the deletion

I used JavaScript to judge.

<script language= "JavaScript" >
function myconfirm (ID)
{
if (Confirm (OK to delete this user?))
{
DeleteUser (ID)
}
}
</script>

This will jump out of the OK and cancel window basket when calling Javascript:myconfirm ()

If the user clicks OK then executes

<script>function DeleteUser (ID)
{window.location = ("Deleteusercommit.jsp?id= '" +id+ "");
}
</script>

I didn't add this to the DeleteUser () and myconfirm (), but I found this <a href=javascript:myconfirm ("+id+") > Delete </a> If you do not have the ID this parameter can not be passed, I would like to change the position of the DeleteUser () function to get the value of the ID, and then found no, and then add this ID parameter. This goes through without problems.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.