first, the basic concept of DOM: The DOM is the Document Object model, which is a tree model; a document is a label document; An object is a document; A model refers to something that is abstracted.
ii. Windows Object Operations: 1, properties and Methods: Property (Value or Sub-object):opener: Opens the source window of the current window, if the current window is open for the first time, then opener is Null.
dialogargument: The return value of the dialog box.
Sub-object: History,location,document,status,menubar,toolbar, etc.
Method (function): event (pre-Set program, triggered).
2.window.open("Part One", "Part II", "Part Three", "Part IV")
The first part: write the page address.
The second part: _blank open mode, or _self, in a new window or itself open
The third part: Control the Open Window format, you can write multiple, separated by a space;
toolbar=no New Open Window No toolbar,menubar=no no menu bar,status=no no status bar;
width=100 height=100 width height;left=100 Open window distance to the left;
resizable=no window size is not adjustable, scrollbars=yes appears scroll bar, location=yes has address bar;
Note: window.open also has a return value, and its return value is the newly opened Window object.
For example: Var a=window.open (); Opens a window and saves it in a variable.
Open multiple windows and save in array W: function Openw ()
{
W[i++]=window.open ();
}
3,window.close (): close the current window;
W.close (): Close the window that is saved in the variable W;
Close multiple child windows: First put the open window into an array and use the loop to turn it off;
Close the source window that opens the current window:window.opener.close ();
4, adjust the page:window.navigate ("url") to jump to the target page, the Google browser has a bug;
Window.moveto (x, y) moves to the page to a location where the position is determined by X and y;
Window.resizeto (wide, high) adjusts the width and height of the page;
Window.scrollto (x , Y) scrolls the page to where Y represents the vertical scroll.
5. Modal dialog box and non modal dialog box:
Modal dialog box (Modal dialogue box), which means that the dialog box must first be responded to when the user wants to work with an application other than the dialog box. If you click the OK or Cancel button to close the dialog box, it is always pinned to the non-modal dialog box, and the difference is whether the user is allowed to manipulate other objects while the dialog box is open.
Open modal dialog:window.showmodaldialog ("url", "Value passed to target dialog box", "window feature parameter");
Feature parameters: separated by semicolons, pixel size with px. Dialogheight,dialogwidth,center, etc.
Open the Non-modal dialog box:window.showmodelessdialog ("url", "Value passed to target dialog box", "window feature parameter")
var a=window.dialogargument; You can use a parameter to get the value passed by modal or non-modal dialog boxes.
Third, Window.history object:
window.history.back (); page to rewind;
Window.history.forward (); Page forward;
window.history.go (n); n If a positive number represents a forward n page, n is a negative number that represents a backward N page.
Iv. window.location object: (location bar)
var a=window.location.href; gets the address of the current page;
Window.location.href= "http://www.baidu.com"; Change page address, will jump page
Window.location.hostname: Host name, domain name, website name, available variable to receive;
Window.location.pathname: path name, available variable to receive.
v. Window.status object: (status bar)
Window.status= "What to display in the status bar";
Example: function S ()
{
Window.status= "Go forward and walk like this";
}
2017-3-28 JavaScript DOM Operations