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!! =)

1 comment:

  1. Get other related with javascript scripts

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

    ReplyDelete