PHP Basic Learning Notes (6)

Source: Internet
Author: User
Tags custom name
Window object

The Window object is the Windows object, which is an open Web page that must be "loaded" into a Window object. The Window object represents the Windows. Learning Window objects is nothing more than learning the methods provided by window (like learning the event object is nothing more than learning to use several properties of the event object)

window Methods for several popup dialog boxes of the object:

1 .    Window.alert ("Here is the text message")            ; // can be thought of as just a textual informational cue.  2.        var  V1  =  window.prompt ("text hint", "default Info")    // Pop up a dialog box for the user to enter text information. Often used to ask the user a question that requires text to answer. It returns a "string value"of3.        var  V2  =  window.confirm ("A question of the sexual nature")        ; // pop up a question to the user asking "true and false", the user can answer "true and false". It is often used to ask the user a question that requires a yes/no response. It returns a Boolean value (True/false). 

window object Pop-up window method:

window.open ();--can pop up a "small" window, which will also be able to "place" a page.

The syntax form is as follows:

window.open ("To open Web address url", "Give me the name of a new Window", "New window appearance parameter set para");

URL: Can be a relative address or an absolute address.

Name: Custom name, follow the naming rules can be, such as N1, Win1, S1

Para: This setting has several items, each separated by commas, with each entry in the form of a key name = value. Examples are as follows:

Width=,        Height= +, left        = $,        //  Indicates the distance from the left of the screen        top=,        // indicates the distance from the top of the screen        menubar = yes;    // indicates that the open window has a menu bar (no), or you can use the 1,0        Toolbar    = yes;    // indicates that the open window has a toolbar (no), or you can use the 1,0        Location =  Yes;    // indicates that the open window does not have an address bar (no), or you can use the 1,0 (the actual modern browser does not work for this, it becomes a location must be shown)        Scrollbars=yes;    // indicates that the open window has a scroll bar. ........         A comprehensive example of the DHTML Complete Handbook    : window.open ("http://

Timer method for Window object:

Timer: is to let the browser every certain time automatically to do certain things!

Grammatical form:

var T1 = window.setinterval ("code to execute S", Interval time t);//This is called "Creating a Timer" with the name: T1

Explanation: Every time t is set, the code s in the quotation marks will be executed. The unit of T is "milliseconds". Here, the code to execute is usually a function call statement, the real thing to do is to go to the function to complete.

Once the timer is created, it will automatically "let others" allow it to either "live" or "die".

Ways to find web objects

??? document.getElementById ("id name");//id attribute All tags can be usedfind a Label object by ID. Document.getelementsbyname ("name name");//The Name property is typically used only on forms. a number of label objects-that is, collections-are found by name. The collection here is actually the equivalent of putting a number of objects in an array. The usage of the collection is exactly the same as the array.    Note that even if there is only one object in the found result, the collection is also used as an array. document.getElementsByTagName ("label name");    The tag name gets to all of the tag objects in the Web page-also the collection, as in the usage. Another more useful usage of getElementsByTagName is:??    obj. getElementsByTagName ("label name"); //obj is a smaller label object. getting several objects of the specified tag name in the obj tag is more practical. document.body:--directly represents the body of the Web page, which is a specific tag object. document.documentelement:--directly represents the HTML in the page as this particular tag object. document.images:--represents all IMG tag objects in a Web page, and is also a collection that uses the same set as above. In fact, it is also equivalent to: document.getElementsByTagName ("img");d ocument.links:--represents all the a link tag objects in a Web page and is also a collection. document.anchors:--represents all a anchor-point label objects in a Web page, and is also a collection? document.forms:--represents all Form form objects in a Web page and is also a collection.Event. Target/Event. srcelement:--represents the event source--the event source is the object? This:--Represents the event source--meaning that, like the Window object, the event object, the Document object does not need to "find", but is used directly. 

Timer method for Window object

Use of repetitive timers: The browser executes the code (function) repeatedly at a specified interval of time.

var T1 = Window.setinterval ("function ()", Interval time); Create a recurring timer and name it "T1"

Window.clearinterval (T1)//Clear (Stop/destroy) this repetitive timer

--the principle of alarm

Use of disposable timers: The browser executes the code (function) once after the specified time.

var t2 = window.settimeout ("function ()", Interval time); Create a one-time timer and name it "T2"

Window.cleartimeout (T2); Clear (Stop/destroy) the disposable timer

--Time bomb principle

--disposable timers are typically used for some code that executes once

Inline Frame (window)

Contrast frame window: the frame window splits the "Current large window" into several small windows, with one page in each window.

        

Inline window: "Dig" a range of areas in the current page as a small window that can place other pages.

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

The embedded window is labeled: IFRAME, using the following:

The IFRAME looks very similar to the TEXTAREA label, but the use is completely different.

The IFRAME looks very similar to the TEXTAREA label, but the use is completely different.

Introduction of external JS file

Note: JS file suffix js, there can only be JS syntax code, can not have

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.