Php basic learning notes javascript (8)

Source: Internet
Author: User
A window object is a window object, that is, any open webpage. It must be loaded into a window object. The window object represents the window. Learning window objects is actually nothing more than learning the methods provided by window (similar to learning the event object is nothing more than learning the properties of using the event object)

A window object is a window object, that is, any open webpage. It must be loaded into a window object. The window object represents the window. Learning window objects is actually nothing more than learning the methods provided by window (similar to learning the event object is nothing more than learning the properties of using the event object)

Window object

A window object is a "window object", that is, any open webpage. It must be "loaded" into a window object. The window object represents the window.LearningThe window object is nothing moreLearningWindow provides several methods (similarLearningThe event object is nothing moreLearningUse the attributes of the event object)

WindowMethods of the pop-up dialog box of the object:

1. window. alert ("here is text information"); // it can be considered as a text prompt. 2. var v1 = window. prompt ("text prompt", "default information") // a dialog box is displayed for users to enter text information. It is usually used to ask a user a question that requires text to answer. It returns a "string value" 3. var v2 = window. confirm ("A question about whether or not"); // a question is displayed asking the user about "true or false". The user can answer "true or false ". It is usually used to ask a user a question that requires "yes/no. It returns a Boolean value (true/false ).

WindowMethod of the object pop-up window:

Window. open (); -- a "small" window can be displayed, and a webpage can be placed in the window.

The syntax format is as follows:

Window. open ("url of the webpage to be opened", "name of the new window by yourself", and "para" for the appearance parameter of the new window ");

Url: it can be a relative address or an absolute address.

Name: custom name, which can follow naming rules, such as n1, win1, s1

Para: There are several items in this setting. each item is separated by a comma. The format of each item is: item name = value. Example:

Width = 400, height = 300, left = 500, // indicates the distance from the left of the screen to top = 300, // indicates the distance from the top of the screen to menubar = yes; // indicates that the opened window has a menu bar (no), or you can use 1, 0 toolbar = yes; // indicates that the opened window has a toolbar (no ), you can also use 1, 0 location = yes; // to indicate that the Opened Window does not have the address bar (no), or you can use 1, 0 (the actual modern browser has expired, and the location must be displayed) scrollbars = yes; // indicates that the opened window has a scroll bar. ............. A comprehensive example of "Dhtml full manual": window. open ("http://www.baidu.com", "db", "width = 400, height = 300, left = 500, top = 300, menubar = yes, toolbar = 1 ") DHTML full manual. DHTML is "Dynamic html" (Dynamic HTML)

The timer method of the window object:

Timer: enables the browser to automatically perform certain tasks at regular intervals!

Syntax format:

Var t1 = window. setInterval ("code to be executed s", interval t); // This is called "Create a timer" and its name is t1.

Explanation: Code s in quotation marks will be executed at every specified time t. T is measured in milliseconds ". Here, the code to be executed usually uses a function call statement. The real thing to do is to complete it in the function.

Once a timer is created, it will automatically "allow others" to allow itself to either "survive" or "die"

How to find webpage objects

??? Document. getElementById ("id name"); // The name attribute is usually used only on the form. // Event.tar get/event. srcElement: -- indicates the event source -- is the event source an object? This: -- indicates the event source -- it means that, like the window object, the event object, and the document object, are directly used instead of "finding.

Timer method of window object

Repetitive timer usage: the browser will repeatedly execute the code (function) at a specified interval ).

Var t1 = window. setInterval ("function ()", interval); // create a recurring timer and name it "t1"

Window. clearInterval (t1) // clear (stop/destroy) This recurring Timer

-- Alarm Principle

One-time Timer: The Browser executes the code (function) once after the specified time ).

Var t2 = window. setTimeout ("function ()", interval); // create a one-time timer and name it "t2"

Window. clearTimeout (t2); // clear (stop/destroy) the one-time Timer

-- Theory of time bomb

-- A one-time timer is usually used for some code that only needs to be executed once.

Embedded framework (window)

Comparison frame window: The frame window divides the current large window into several small windows, each with a webpage.

        

Embedded window: it is a small window that is located in the "current webpage" and dug out a range of areas. This window can be placed on other webpages.

Here, the area dug out is actually the box concept in our html/css-the rectangular area.

Introduce external js files

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.