The Window. open () method has a return value, which is the window object of the opened subwindow.
1. BOM (Browser object model). below is the BOM tree
Window: browser object
Sub-objects in Window:
Navigator browser Information
Location address bar
Document
Screen
1. window object
- Alert (message): window. alert ();
- Confirm (message): confirmation box window. confirm ();
- Prompt (message [, defstr]): input box
- Open (url [, name [, features]): open a new window.
- Close (): close the window
- Blur (): lost focus
- Focus (): Get focus
- Print (): print
- MoveBy (x, y): relative movement
- MoveTo (x, y): absolute movement
- ResizeBy (x, y): Relative Dimension change
- ResizeTo (x, y): Absolutely change the size
- ScrollBy (x, y): relative scrolling
- ScrollTo (x, y): absolute scrolling
- SetTimeout (expression, millisecond): Run Once
- ClearTimeout (timer object)
SetInterval: timer (each time after which the specified code is executed repeatedly)
Type parameters of the Open () method:
- Menubar: menu bar
- Toolbar: tool bar
- Scrollbars: scroll bar
- Fullscreen: Full Screen
- Directories: Link
- Location: Address Bar
- Status: status Bar
- Resizable: whether the size can be changed
Value Range of the preceding parameters: yes/no 1/0 1/yes: 0/no: None
- Width, height, left, top: width, height, left margin, top margin
1. Interaction between multiple browsers
The Window. open () method has a return value, which is the window object of the opened subwindow.
For example, Var child?##open('demo01.html ');
Childvariable refers to the window object of the demo01.html subwindow opened. You can use
Child.doc ument references any html object in the Child Window
Can a subwindow reference a parent window? A: Yes.
In the child window, use window. opener, which indicates the window object of the parent window.
Extends extends opener.doc ument. getElementById ();
2. Interaction between multiple Windows:
Premise: there must be a parent-child relationship between windows (that is, another window is opened in one window)
1) reference the child window in the parent window:
Code in the parent window:
Var child = window. open ("url"); child is the window object of the opened subwindow.
Child.doc ument. getElementById (); obtain the html element in the subwindow object
2) reference the parent window in the Child Window
Code in the subwindow:
Using metadata opener.doc ument. getElementById (); obtain the html element in the parent window
Window. opener: refers to the reference to the parent window object of the current window, indicating the window object of the parent window
# P # php tutorial-javascript programming-bom in js # e #
2. navigator object
- AppCodeName: Internal code
- AppName: browser name
- AppVersion: browser version
- Platform: operating system type
- OnLine: onLine
- CookieEnabled: whether cookie is supported
3. location object (location)
- Host: host
- L port: if the default port 80 is used, it is not displayed.
- Href: Address (readable and writable)
- Pathname: Path
- Protocol: protocol
- Search: query string
- Assign (url): Jump
4. screen Object (screen)
- AvailHeight available height
- AvailWidth available width
- ColorDepth color
- Height
- Width
5. floating windows (random)
6. document Object
- LinkColor hyperlink color
- Hyperlink color in the action of alinkColor
- Hyperlink color after vlinkColor Function
- BgColor background color
- FgColor font color
- Title document title
- GetElementById ("id"): obtains an element through the id attribute.
- GetElementsByName ("name"): obtains certain elements through the name attribute.
- GetElementsByTagName ("tagname"): obtains certain elements by using the element name.