JS popup box, dialog box, cue box, pop-up window summary

Source: Internet
Author: User

First, JS of the three most common dialog box

====================== js most commonly used three pop-up dialog boxes  ========================         //Popup dialog box and output a message       function ale ()  {           //Popup a dialog box            alert ("Hint info! ");         }        //pops up a query box, There are ok and Cancel Buttons       function firm ()  {           //value returned using the dialog box   (true  or  false)            if  (Confirm ("Are you sure to submit it?") "))  {              alert (" clicked OK ");           }           else {        &nbsP;     alert ("clicked Cancel");           }         }        //pops up an input box, Enter a text to submit       function prom ()  {           var name = prompt ("Please enter your name",  ");  //assigns the input to the variable  name  ,            //here to note is that prompt has two parameters, preceded by a hint, The following is when the dialog box comes out, the default value in the dialog box           if  (name)//If the returned has content            {               alert ("Welcome:"  + name)            }        }

Ii. 6 prompt boxes and actions commonly used when clicking a button

<!-----------button prompt---------->  <input type= "button"  name= "btn2"  id= "BTN2"  value= "Delete"  onclick= "return confirm (' yes/no '););    <!----------- button Prompt box---------->   <input type= "button"  name= "btn2"  id= "btn2"  value= " Hint " onclick=" Javascript:alert (' Are you sure you want to delete it? ');    <!-----------submit button---------->   <input type= "button"  value= "Submit"  onclick= "javascript:window.location.href= ' http://www.baidu.com ';" />    <!-----------Close button---------->   <input type= "button"  value= "Close"  onclick= "javaScript:window.close ();" >    <!-----------return and close the connection---------->   <a href= "#"   Onclick= "Javascript:;window.opener.location.reload (); Window.close ()" > Return </a>  javascript: Window.location.reload ();//returns the current page and refreshes the     <! -----------return to the previous page---------->   <input type= "button"  name= "button"  value= " <  return to " onclick=" Javascript:history.go ( -1) "/>


This article from "Kangjunfei" blog, declined reprint!

JS popup box, dialog box, cue box, pop-up window summary

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.