1, the basic concept of the DOM
The DOM is the Document Object model, which is a tree model; a document is a label document (an HTML document) that refers to every element in a document; A model is something that is abstracted.
2. Windows object Operations
I. Properties and Methods
Property (value or sub-object)
Opener: Opens the source window of the current window, or opener is null if the current window is open for the first time the browser is started.
Dialogargument: The return value of the dialog box.
Sub-object: History record, location bar, document,status status bar, menubar menu bar, toolbar toolbar, etc.
Method (function): event (pre-Set program, triggered)
Windows.open ("Part I", "Part II", "Part Three", "Part IV")
Characteristic parameters of Windows.open:
The first part: write the page address.
Part II: _blank open mode, in a new window or in its own window
The third part: Control the Open Window format, you can write multiple, separated by a space as follows:
Toolbar=no the newly opened window has no tool bar;
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 scroll bar appears;
Location=yes has address bar;
Windows.open also has a return value, and its return value is: The newly opened Window object.
For example:
The simplest open window: window.open ("untitle-6.html");
Open a window and save it in a variable: var w= window.open ();
You can save multiple open windows in the array W:
function Openw ()
{
W[i++]=window.open ();
}
Third, 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 the array and use the loop to turn it off;
Close the source window that opens the current window: Window.opener.close ();
Iv. interval and delay
Interval execution of a piece of code (function): Window.setlnterval ("Code to execute", number of milliseconds between intervals)
Cleanup interval execution: window.clearlnterval (ID of interval), code to clear interval execution after a loop
Delay a period of execution of a piece of code (function): Window.settimeout ("Code to execute", number of milliseconds to delay)
Purge delay: window.cleartimeout (delayed ID); Clear sertimeout
Five, adjust the page
Window.navigate ("url") jumps to the target page, there is a bug under Google Chrome;
Window.moveto (x, y) moves the page to a location that is determined by X and y;
Window.resizeto (wide, high) adjusts the page to a certain width and height;
Window.scrollto (x, Y) scrolls the page to where, Y represents portrait scrolling;
Vi. modal dialogs and non-modal dialog boxes
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. such as a single "OK" or "Cancel" button, etc. the dialog closes, and the non-modal dialogs are always pinned, with the difference between whether the user is allowed to do other objects while the current 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, et
Open the non-modal dialog: 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 the modal or non-modal dialog box.
3. Window.history Object
Window.history.back (); Page forward backward;
Window.history.forward (); Page forward;
Window.history.go (n); N If an integer represents the forward n page, n is a negative number that represents a backward n page, which is commonly used.
4. Window.location Object
Location Bar
var s = window.location.href; Get the address of the current page
Window.location.href= "http://www.baidu.com"; Modify the page address bar, will jump page
Window.location.hostname: Host name, domain name, site name, available variable receive
Window.location.pathname: path name, available variable receive
5. Window.status Object
Status bar, you can add the text you want to display to the status bar
Window.status= "What to display in the status bar"; Set the status bar text
For example:
function S ()
{
Window.status= "Go forward, just walk";
}
Dom manipulation of JavaScript-non-focus parts