javascript--Pop-up dialog box Four dialog box to get user input values.

Source: Internet
Author: User

Let the user click OK to cancel. Let the user enter a value. Opens the specified window

Alert ("Message") Confirm (' message ') prompt ("message") Open ("url")

http://www.maobuy.cn

First of all, I would like to say a few words about JavaScript, I hope that we can seriously learn this programming language, because it gives us in the development of Web pages, will bring a lot of surprises. JavaScript is generally run on the client side, mainly for the development of some Web page dynamic effect, in fact, it has a lot of use, such as validating the form content, and now more popular AJAX applications.

Today I'll write a pop-up dialog box in javascript:

First: Alert ("message")

The second type: Confirm ("message")

Third clock: Prompt ("message")

Type Fourth: open ("url")

The First Alert dialog box is the simplest and most commonly used pop-up dialog box, usually for informational purposes, the dialog box contains a button, and clicking the button in the dialog box closes the dialog box.

The Second confirm dialog box returns a Boolean value, which is typically used for user selection, which contains two buttons, generally one is "confirm", the other is "Cancel", for example, when we are developing a program, we create a delete button to prevent the user from doing business, This dialog box is commonly used: "Are you sure you want to delete it?" "If you choose OK, perform the deletion, and if you choose Cancel, return without any action."

The third kind of prompt dialog box, the main user gets the user input information, for example, a pop-up dialog box:

<script language= "JavaScript" >
var name=prompt ("What is your name?");
document.write (name);
</script>

The prompt dialog box includes two buttons ("Confirm" and "Cancel") and a text box that gets the information the user enters.

The fourth type is actually a dialog box to open a Web page, the open method contains a lot of parameters, mainly the user settings browser display appearance:

window.open ("Webpage.asp?", Derek, "Height=100,width=100,status=yes,toolbar=yes,
Menubar=no,location=no ");
This statement opens a new window with the page webpage.asp, the parameter is Var, the name is Derek, the height is 100, the width is 100, the status bar and the toolbar are displayed, and the menu and address are not displayed.

The individual attribute parameters that are summarized are as follows:
window = Object.open ([URL] [, name] [, features] [, replace]]]
URL: URL of new Window
Name: Names of new windows, can be empty
Featurse: Property control string, which controls the various properties of the window, separated by commas between properties.
fullscreen= {yes/no/1/0} is full screen, default No
channelmode= {yes/no/1/0} shows Channel bar, default No
toolbar= {yes/no/1/0} shows the toolbar, default No
location= {yes/no/1/0} shows the address bar, default No
directories = {yes/no/1/0} whether the turn button is displayed, default no
status= {yes/no/1/0} shows window status bar, default No
menubar= {yes/no/1/0} shows menu, default No
scrollbars= {yes/no/1/0} shows scroll bars, default Yes
resizable= {yes/no/1/0} whether the window can be resized and the default no
Width=number window width (pixel units)
Height=number window height (pixel units)
Top=number window from top of screen (pixel units)
Left=number window to the left of the screen (pixel units)

javascript--Pop-up dialog box Four dialog box to get user input value

Let the user click OK to cancel. Let the user enter a value. Opens the specified window

Alert ("Message") Confirm (' message ') prompt ("message") Open ("url")

http://www.maobuy.cn

First of all, I would like to say a few words about JavaScript, I hope that we can seriously learn this programming language, because it gives us in the development of Web pages, will bring a lot of surprises. JavaScript is generally run on the client side, mainly for the development of some Web page dynamic effect, in fact, it has a lot of use, such as validating the form content, and now more popular AJAX applications.

Today I'll write a pop-up dialog box in javascript:

First: Alert ("message")

The second type: Confirm ("message")

Third clock: Prompt ("message")

Type Fourth: open ("url")

The First Alert dialog box is the simplest and most commonly used pop-up dialog box, usually for informational purposes, the dialog box contains a button, and clicking the button in the dialog box closes the dialog box.

The Second confirm dialog box returns a Boolean value, which is typically used for user selection, which contains two buttons, generally one is "confirm", the other is "Cancel", for example, when we are developing a program, we create a delete button to prevent the user from doing business, This dialog box is commonly used: "Are you sure you want to delete it?" "If you choose OK, perform the deletion, and if you choose Cancel, return without any action."

The third kind of prompt dialog box, the main user gets the user input information, for example, a pop-up dialog box:

<script language= "JavaScript" >
var name=prompt ("What is your name?");
document.write (name);
</script>

The prompt dialog box includes two buttons ("Confirm" and "Cancel") and a text box that gets the information the user enters.

The fourth type is actually a dialog box to open a Web page, the open method contains a lot of parameters, mainly the user settings browser display appearance:

window.open ("Webpage.asp?", Derek, "Height=100,width=100,status=yes,toolbar=yes,
Menubar=no,location=no");
This statement opens a new window, the page is webpage.asp, the parameter is Var, the name is Derek, the height is 100, the width is 100, the status bar and the toolbar are displayed, and the menu and address are not displayed. The individual property parameters that the

summarizes are as follows:
window = Object.open ([URL] [, name] [, features] [, replace]]]
URL: The URL address of the new window
Name: The name of the new window, which can be null
Featurse: Property Control string, which controls the various properties of the window, separated by commas.
fullscreen= {yes/no/1/0} is full screen, default no
channelmode= {yes/no/1/0} whether the Channel bar is displayed, and the default no
toolbar= {yes/no/1/0} displays the work With bar, default no
location= {yes/no/1/0} displays address bar, default no
directories = {yes/no/1/0} show turn button, default no
status= {YES/NO/1 /0} whether the window status bar is displayed, the default no
menubar= {yes/no/1/0} shows the menu, the default no
scrollbars= {yes/no/1/0} whether the scroll bar is displayed, the default Yes
Resizable= {yes/no/1/0} whether the window can be resized, default no
width=number window width (pixel units)
Height=number window height (pixel units)
Top=number window away from top of screen (pixel units)
Left=number window to the left of screen (pixel units)

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.