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.