Window. Prompt () method details

Source: Internet
Author: User
The window. Prompt () method is often used to accept some parameters, such as common URLs and emails.
So, how does prompt pass the value? The following is an example.
1. Sample Code

Pro.htm

<Script language = JavaScript>
<! --
Function Pro (){
VaR Tempa = Window. Prompt ('enter your name ','');
If (Tempa = "" | Tempa = NULL ){
Tempa = "You have not entered any text ";
}
Alert (Tempa );
}
-->
</SCRIPT>
<Body onload = "Pro ()"> </body>

2. Demo
(1) Open pro.htmin IE and you can see the following interface. When pro.htm is loaded, the prompt dialog box is automatically displayed.
You are prompted to enter parameters.


(2) After the input is complete, the received value will be returned to the variable Tempa. The next step is to determine whether the user has entered the parameter. A prompt box will pop up.
If you have a number of parameters, the information you just entered is displayed. For example, when you enter "forget your worries", the following page is displayed:


If no data is input, the following page is displayed:
String 2

String 8

After demonstration in this example, you should have some knowledge about the use of window. Prompt!

 

Related Article

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.