JS Prompt and Confirm message dialog small knowledge points

Source: Internet
Author: User

1<! DOCTYPE HTML >234<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>5<title> we interact under </title>6<script type= "Text/javascript" >

//First prompt, after confirm 7function str () { 8var a=prompt ("JS advanced"); 9 if ("JS advanced article") {//return value is "JS Progressive article"var b=confirm ("Focus on JS high-level article"); One } }
-</script> - the - -<body> -<input name= "button" type= "button" onclick= "str ()" value= "Commit"/> + -</body> +

Output:

The Prompt message dialog box (including a OK button, a Cancel button and a text input box) is popped up to display the JS advanced text, and the Confirm Message dialog box (which includes a OK button and a Cancel button) is displayed when the input box is entered into the JS Advanced page.

"Focus on JS Advanced chapter"

First confirm, then prompt.
1function str () {2var a=confirm ("JS advanced article"); 3 if (a==true) {//return value is True4var b=prompt ("Focus on JS Advanced article"); 5 }6 }

Output:

First pop-up Confirm message dialog box (including a OK button and a Cancel button), display "JS Advanced article", click OK, pop-up display "JS Advanced" prompt message dialog box (containing a OK button, Cancel button and a text input box), in the Text input box Input JS Advanced Chapter

Prompt return value: Click OK button, the contents of the text box will be the function return value ; Click the Cancel button to return null
Confirm return Value: Returns Truewhen the user taps the "OK" button and returns false when the user taps the "Cancel" button

JS Prompt and Confirm message dialog small knowledge points

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.