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.