I accidentally saw the window.prompt() method. I have never used it before and I am very ignorant. But let’s study now.
In a web page, sometimes a prompt box needs to pop up, and the user also needs to input some content in the prompt box. In this case, the prompt object can be used. The specific implementation is as follows.
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script> var _saytext = decodeURI("我真笨"); var _text; var err_list = new Array("别乱填!!","快填,别试了!!"); _text = prompt("在下面输入框填“" + _saytext +"”"); for ( i = 0; _text != _saytext; ++i) { if ( i == err_list.length) { i = 0; } alert(err_list[i]); _text = prompt("在下面输入框填“" + _saytext +"”"); } alert("嗯,这就对了!"); </script> </head> </html>
The above is the entire content of this article, I hope you all like it.