Wednesday, February 10, 2010

Javascript : Return Confirm()

Choice 1:

<script>
function confirmDelete(delUrl) {
if (confirm("Are you sure you want to delete")) {
document.location = delUrl;
}
}
</script>

<a href="javascript:confirmDelete('delete.page?id=1')">Delete</a>

Choice 2:

<a href="delete.page?id=1" onclick="return confirm('Are you sure you want to delete?')">Delete</a>

Choice 3:

<script>
function logout()
{
if (confirm('Are you sure you want to logout?'))
location.href = "http://www.tackleprices.com/merchant/logout.php";
}
</script>

aI("text=Logout;url=javascript:logout();");

Choice 4:



If you find this useful, would you like to buy me a drink? No matter more or less, it will be an encouragement for me to go further. Thanks in advance!! =)

2 comments:

  1. Get other related with javascript scripts

    http://jqueryplugins.net/example/core-java-script/

    ReplyDelete
  2. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or learn thru JavaScript Online Training in India. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai

    ReplyDelete