Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of JavaScript pop-up boxes and dialog boxes and prompt boxes?

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article shows you JavaScript pop-up boxes and dialog boxes and prompt box methods are how, the content is concise and easy to understand, absolutely can make your eyes bright, through the detailed introduction of this article hope you can gain something.

Through js to achieve web page pop-up of various forms of windows, commonly used: pop-up boxes, dialog boxes, prompt boxes and so on.

How does js pop up the dialog box

Dialog box

Pop up the dialog box and output a prompt message

Alert ("prompt!")

Inquiry box

A pop-up query box with confirm and cancel buttons, using the value returned by the dialog box (true or false)

If (confirm ("are you sure to submit?") {

Alert ("clicked OK")

} else {

Alert ("Click cancel")

}

Input box

A pop-up input box, enter a paragraph of text, you can submit. It should be noted that prompt has two parameters, the first is the prompt, and the later is the default value in the dialog box when the dialog box comes out.

Varname=prompt ("Please enter your name", ""); / / assign the input to the variable name

If (name) {

Alert ("Welcome" + name)

}

Js pop-up dialog new window

Window.open command to pop up a new window

'The file name of the page.html' pop-up window

The name of the newwindow' pop-up window (not the file name). Optional, empty''can be used instead.

The height of the height=100 window; the width of the width=400 window; the pixel value of the top=0 window from the top of the screen; the pixel value of the left=0 window from the left side of the screen; whether toolbar=no displays the toolbar, yes is displayed; menubar,scrollbars represents the menu bar and scroll bar. Whether resizable=no is allowed to change the window size, yes is allowed; whether location=no displays the address bar, yes is allowed; whether status=no displays the information in the status bar (usually the file has been opened), yes is allowed

'newwin': hides the menu bar address bar toolbar

Window.open ('page.html')

/ / Pop-up window after setting

Window.open ('page.html','newwindow','height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no') / / this sentence is to be written on one line

The above content is what JavaScript pop-up boxes and dialogs and prompt boxes are like. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report