Jump to content

javascript confirm , change title


houssam_ballout

Recommended Posts

Hello all,I was searching for a javascript in which I can change the confirm box title, I had found this http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/but I need help how to make it on a hyperlink, as in my page, I had <a href="test.php?action=del&id=1>Delete</a>the above link works perfect with button, how can I make it work on a href so that when I click on the Delete text, I get the confirmation with Yes , Cancel option, when clicked Cancel, it will do nothing and Yes will delete the record

Link to comment
Share on other sites

what code do you have so far? which part are you getting stuck on? have you looked through the tutorials to get the basics? getting a reference to an object, knowing what properties it has, etc and what you can change...

Link to comment
Share on other sites

Look at this example under confirm:http://labs.abeautifulsite.net/archived/jquery-alerts/demo/I need help in making it in <a href=""></a>also, my current code makes look from the database, so in the current code, with the <input type="button" id="confirm_button"> it will work with on button only.Thanks

Link to comment
Share on other sites

Extending the example on this page: http://www.w3schools.com/js/js_popup.asp You could use

<html> <head> <script type="text/javascript"> function show_confirm(url) { var r=confirm("Are you sure you want to delete?\n\n" + url); if (r==true)   {	 document.location = url;   } else   {	 alert("You pressed Cancel!");   } } </script> </head> <body><a href="javascript:void(0)"  onclick="show_confirm('test.php?action=del&id=1')">Delete 1</a><a href="javascript:void(0)"  onclick="show_confirm('test.php?action=del&id=2')">Delete 2</a> </body> </html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...