Confirm Script Problem
I am a JS newbie so please be patient.
I need to create a page with up to 5 addresses from a DB and an associated "graphic" delete button. If the user hits one of the delete buttons, I want to throw up a confirm box to have them confirm.
I have a short prototype script that is OK with 1 address and an HTML "button":
But I'm not sure how to pass the name of the button to the function.
var r=confirm("Confirm Deletion");
window.location.href = "AMaddAddressAction.cfm?delete=1"
<form id="test" action="AMaddAddressAction.cfm" method="post">
<input type="text" name="user" />
<input type="button" name="rich" value="Delete" onClick="show_confirm()" />
Also I do not know how to do the confirm box with an image for a button
Any ideas would be most appreciated?
Last edited by hefterr; 10-29-2009 at 11:41 AM.
Using "this.name" will reference the name of the input properly from the onclick. You'll need to add some code to the function to parse this name.
You can also add a reference to the calling element's name into the function instead of using it as an argument in the call, using "event.srcElement".
<input type="button" name="rich" value="Delete" onClick="show_confirm(this.name)" />
<input type="button" value="Show Name" name="FOO" onclick="showName()" />
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)