Use window. prompt () to bring up the user input dialog box _ javascript skills

Source: Internet
Author: User
The last dialog box of the window object is the prompt dialog box, which displays pre-configured information and provides text fields for users to input and reply. It includes two buttons, Cancel and OK, allowing you to close the dialog box with two opposite expectations: Cancel the entire operation or receive the text entered in the dialog box and accidentally see the window. the prompt () method has never been used before. But now, let's take a look.

Sometimes a prompt box needs to be displayed on the webpage, and you need to enter some content in the prompt box. This allows you to use the prompt object. the specific implementation usage is as follows.

 Script var _ saytext = decodeURI ("I am really stupid"); var _ text; var err_list = new Array ("Don't fill it out !! "," Enter it. don't try it !! "); _ Text = prompt (" Enter "+ _ saytext +" "in the input box below); for (I = 0; _ text! = _ Saytext; ++ I) {if (I = err_list.length) {I = 0;} alert (err_list [I]); _ text = prompt ("Enter" + _ saytext + "in the input box below);} alert (" Well, that's right! "); Script

The above is all the content of this article. I hope you will like it.

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.