Solved

Javascript "yes", "no" confirm

Posted on 2009-05-16
5
2,237 Views
Last Modified: 2012-06-21
I know there's a way to do this but i cant find an example. I have a button. Click on it. JS code pops up. When "yes" is clicked, i want to call a routine in my aspx page and do whatever.
function confirmDelete() { 

if (confirm("Really delete this article?")) {

return true; 

} else {

return false;

}

 

function confirmDelete() {return confirm("Really delete this article?")}

Open in new window

0
Comment
Question by:Camillia
5 Comments
 
LVL 8

Assisted Solution

by:97WideGlide
97WideGlide earned 100 total points
ID: 24404860
0
 
LVL 15

Accepted Solution

by:
fsze88 earned 300 total points
ID: 24405077
like this?
<script type="text/javascript">
 

function bConfirmFunction(){

  var bConfirmed = confirm("Really delete this article?");

  if (bConfirmed){

    confirmedFunction();

  }

}

function confirmedFunction(){

  alert("yes, confirmed");

}
 

</script>

<form>

<input type="button" onclick="bConfirmFunction();" value="make confirm">

</form>

Open in new window

0
 
LVL 7

Author Comment

by:Camillia
ID: 24405952
thanks, let me read the link and try the example. I think tha's what i'm looking for.
0
 
LVL 3

Assisted Solution

by:channa_m
channa_m earned 100 total points
ID: 24424413
If you are looking for a solution in an aspx page follow this


            <asp:Button ID="btn1" runat="server" Text="Click" OnClientClick="return Confirm('Are you sure');" OnClick="btn1_Click" />
 
 

protected void btn1_Click(object sender, EventArgs e)

    {

        // Handle aspx code here

    }

Open in new window

0
 
LVL 7

Author Comment

by:Camillia
ID: 24424554
thanks, will try it this week.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
My dialog box isnt work, no box displays but text does 8 39
Google Map JavaScript API 4 40
Check if Object property exists? 3 19
How can i get the length? 7 19
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now