JS commonly used pop-up dialog box 3 ways _ Basic knowledge

Source: Internet
Author: User
1: Just reminders, can not make any changes to the script;
2: Generally used to confirm, return TRUE or false, so it can be easily used for if...else ... Judge
3: A dialog box with input, you can return the user filled in the string, common in some of the message or forum input where the insert UBB format picture
We'll show you the following separately:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title> three pop-up dialog box usages </title> <script language=" JavaScript "> Function Ale () {// This basically has nothing to say, is to pop up a reminder of the dialog box alert ("I'm sure you are now using demo one"); Function firm () {//The value returned by the dialog box (TRUE or FALSE) if (confirm) ("Are you sure you want to visit the cloud-dwelling community?") ) {//If true, turn the page to thcjp.cnblogs.com location.href= "http://www.jb51.net"; else {//otherwise stated, illustrious alert ("You have pressed the cancellation, that is to return false"); } function Prom () {var name=prompt ("Please enter your first name", "");//Assign the input to the variable name,//Note that the prompt has two parameters, preceded by a hint, followed by a dialog box after the dialog box with the default value if (name)//if returned with content {alert (welcome: + Name)}} </script> </pead> <body> <p> dialog box three ;/p> <p>1: Just a reminder that you can't make any changes to the script;</p> <p>2: Generally used to confirm, return TRUE or false, so it can be easily used for if else judgment </p> <p >3:A dialog box with input, you can return the user filled in the string, common in some message or forum input where the insert UBB format pictures </p> <p> below we demonstrate:</p> <p> demo one: Reminder dialog box </p> <p> <input type= "Submit" name= "Submit" value= "submitted" onclick= "ale ()"/> </p> <p> Demo II: Confirmation dialog box </p> <p> <input type= "Submit" Name= "Submit2" value= "Submit" onclick= "firm ()"/> </p> <p> Demo Three: Require user input, then give results </p> <p> <input type= "Submit" Name= "Submit3" value= "submit" onclick= "Prom ()"/> </p& Gt </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

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.