Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: HTML yes/no box

  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    4
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Post HTML yes/no box

    Does anyone have a HTML code for a yes/no pop up, when the yes button is clicked another pop up appears and has a spot for them to write their name?

    It would be great if someone could help. Thanks!

  • #2
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    This is not HTML--check out the JS subforum.

    Hint: the function you're looking for is alert()

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,628
    Thanks
    0
    Thanked 648 Times in 638 Posts
    Quote Originally Posted by Apostropartheid View Post
    This is not HTML--check out the JS subforum.

    Hint: the function you're looking for is alert()
    No alert(0 is not what the OP is looking for.

    The only yes/no box an alert contains is the one that sasks if you want to turn off JavaScript or disable future alerts (depending on which browse is displaying it.

    What the OP is looking for is done using JavaScript as well as HTML - the content of each "popup" needs to be created as an HTML form. The "popup" effect is then generated using a JavaScript "lightbox" script.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    newbi (06-28-2012)

  • #4
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    4
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Smile Thanks

    I will look into it more... Thanks for the guidance!

  • #5
    New Coder
    Join Date
    Jun 2012
    Location
    Atlanta, Georgia, United States
    Posts
    34
    Thanks
    0
    Thanked 8 Times in 8 Posts
    You're looking for confirm, prompt, and alert.

    Code:
    ​if ( confirm( "Do you want to insert your name?" ) ) {
        var name = prompt( "What is your name?" );
        alert( "Thank you, " + name );
    }​​​​​​​​​​
    Fiddle: http://jsfiddle.net/jr9Qu/
    Last edited by jonathansampson; 06-28-2012 at 12:23 AM.

  • Users who have thanked jonathansampson for this post:

    newbi (06-28-2012)

  • #6
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Quote Originally Posted by felgall View Post
    No alert(0 is not what the OP is looking for.

    The only yes/no box an alert contains is the one that sasks if you want to turn off JavaScript or disable future alerts (depending on which browse is displaying it.

    What the OP is looking for is done using JavaScript as well as HTML - the content of each "popup" needs to be created as an HTML form. The "popup" effect is then generated using a JavaScript "lightbox" script.
    I was hoping the OP would look into alert() and its related functions to arrive at prompt() and confirm().

    Though a modal method is preferred nowadays, it does not appear to be what was in mind.

  • #7
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,628
    Thanks
    0
    Thanked 648 Times in 638 Posts
    Quote Originally Posted by Apostropartheid View Post
    I was hoping the OP would look into alert() and its related functions to arrive at prompt() and confirm().

    Though a modal method is preferred nowadays, it does not appear to be what was in mind.
    alert () confirm() and prompt() ALL display extra options that you wouldn't want in a live web page - for example:







    Do you really want visitors to your site seeing those checkboxes - that's why you should always substitute a lightbox script for the built in dialogs for live web pages.

    Also a lightbox is the only way to do yes/no.

    Confirm provides OK, cancel and turn off JavaScript as its three alternatives.
    Last edited by felgall; 06-28-2012 at 03:16 AM.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Tags for this Thread

    Posting Permissions

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