Javascript:window Window objects

Source: Internet
Author: User

In JavaScript, Windows represents a Window object. So throughout the entire process, all operations are based on a bullet frame
Of
Example 1: Using the warning box
<script type= "Text/javascript" >
Window.alert ("Hello World");
</script>

Code:


Using window to implement data input operations
Example 2: Observing the input operation of the data
<script type= "Text/javascript" >
var name = window.prompt ("Please enter your name", "Your Name");
document.write ("
</script>

Code:

When default:

When you enter your name:

Output Result:


You can also open other child windows within the Window object.
Example 3: Open another window
<script type= "Text/javascript" >
window.open ("pass.html");
</script>

Code:

When default:

Set not to block windows:

Click "Yes" to open the window:


There is a very interesting feature in the Windows window: Confirmation box.
Example 4: Delete is required to confirm
<script type= "Text/javascript";
Window.onload = function () {
document.getElementById ("Deletebtn"). AddEventListener (' click ', Function () {
if ( Window.confirm ("OK to delete?") ") {
window.location =" pass.html "; Jumps to the specified path
}
},false);

& Lt;/script>

Code:

By default, click "Delete Message" and a confirmation box appears:

Click "OK" to jump to the specified path interface:

Summarize:

1. Do not use warning box, use once can;
2. Confirm the confirmation before performing some important updates;
The 3.window.location can be jump-operated.

Javascript:window Window objects

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.