houssam_ballout Posted January 17, 2012 Share Posted January 17, 2012 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 More sharing options...
thescientist Posted January 17, 2012 Share Posted January 17, 2012 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 More sharing options...
houssam_ballout Posted January 18, 2012 Author Share Posted January 18, 2012 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 More sharing options...
thescientist Posted January 19, 2012 Share Posted January 19, 2012 where is your code Link to comment Share on other sites More sharing options...
scott100 Posted January 19, 2012 Share Posted January 19, 2012 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.