CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2005
    Posts
    2

    Question Pop up window with Yes/No button

    Hi Gurus,

    I have currently working on a web application where one of the requirement upon submitting a form, a pop up window is to appear asking some confirmation from the user and user have to click either the "Yes" or "No" button.

    I know in javascript there is a confirm() method where user can either click "OK" or "Cancel" button.

    But what the user wants is the "Yes " and "No" button, please advise how should I go about doing this.

    Thanks and Regards,
    Julie

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Pop up window with Yes/No button

    Well, you can use VBScript's MsgBox function. The problem with that is compatibility. It is only IE compatible.

    Take a look here.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Oct 2006
    Location
    slavia
    Posts
    42

    Re: Pop up window with Yes/No button

    when u do this

    if(confirm('are u sure')){ //yes will return value true or 1
    do this
    }
    else //this is when no is clicked
    {
    do this
    }

    actually u can do it in this way as well
    a = confirm('are u sure?');
    if(a) //mean yes or true
    {
    //do this when yes
    }
    else{
    //do this when no
    }

    //

    have a nice try

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Pop up window with Yes/No button

    szpilman, Once again, you misunderstand the question.

    julieths wants the buttons to say "Yes" or "No". You are using the regular example of "Ok" or "Cancel".

    Please don't attempt to power post. It kind of seems like you are attempting to just get your post number up. I hope this is not the case.

    Take care.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Oct 2006
    Location
    slavia
    Posts
    42

    Re: Pop up window with Yes/No button

    @julieth..
    may be u can try it by creating a new window pop-up from javascript.
    that new window can be controlled from ur current page.

    try to understand this code please ...
    function dirtypop()
    {
    var generator=window.open('','name','height=400,width=500');

    generator.document.write('<html><head><title>Popup</title>');
    generator.document.write('<link rel="stylesheet" href="style.css">');
    generator.document.write('</head><body>');
    generator.document.write('<p>This page was generated by
    the main window.</p>');
    generator.document.write('<p><a href="javascript:self.close()">
    Close</a> the popup.</p>');
    generator.document.write('</body></html>');
    generator.document.close();
    }

    the parent form that call this new window in JavaScript is called
    opener

    have a nice try ..
    Last edited by szpilman; October 7th, 2006 at 08:12 AM.

  6. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: Pop up window with Yes/No button

    szpilman, Please stop posting irrelevant posts. If you don't understand, don't post. I already supplied the answer, and even clarified to you what was originally desired.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  7. #7
    Join Date
    Oct 2006
    Location
    slavia
    Posts
    42

    Re: Pop up window with Yes/No button

    peace ..
    just wanna try to help.
    i admit the i misunderstood the first...
    but i dont think my second answer was irrelevant ...
    i think it give a clue dude..
    anyway
    sorry
    try to be cool dude

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured