,dialogwidth,center, etOpen 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 ObjectWindow.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 pag
and methods of the Window object can be accessed directly. It is the only property BOM and attribute Dom.2.1 The Main method of the Document object:(1) AddEventListener ();--Add Event listener(2) appendchild ();--Add node(3) createelement (); --Create a node(4) getElementById (); --Gets the DOM node for the specified ID(5) Getelementsbyname (); --Gets the node collection of the specified name(6) getElement
HTML DOM (Document Object model)When a Web page is loaded, the browser creates a Document object model for the page.The HTML DOM model is constructed as a tree of objects. Windows Object Operations
window.open ()-Open a new window
Window.close ()-Close the current window
1.windows.open ("Part I", "second part", "Part Three", "Part IV")The first part: Write page address URLThe second part:
false, otherwise there will be no result. These two methods are used for timing, which calculates the exact time spent on an operation.Console.time ()Console.timeend ()The time method indicates that the timing begins, and the Timeend method indicates that the timing is complete. Their arguments are the names of the timers. After calling the Timeend method, the console window displays the timer name: the cost ofTime ".Console.profile ()//used to create a new performance tester (profile) whose pa
; Gets the state of the checkbox true to tick the action individual style style.xxx // Manipulating styles is more granular, manipulating individual style properties, or adding a style property to a label Style.backgroundcolor //Example: Styles in CSS can be connected through "-", in JavaScript, all "-" are removed, "-" capitalization Action property Note: CSS style with-, in JS need to-remove, at the same time will-the first letter in the back, such as Background-color in JS is BackgroundCol
value.
In-line methods.
inline style, when you write FN (), you must have parentheses at this point, otherwise parse to a string .
Write event drivers. Operations on the DOM
Notes for writing code:
When writing attribute
//Previous sibling nodeNote that the child nodes, not only the element nodes, text, annotations and so on belong to the node; (iii) Traversal of node trees based on elementsParentelementChildrenNextelementsiblingPreviouselementsiblingFirstelementchildLastelementchildIn addition to the children, several other IE9 versions are not supported;12class="Div1">3 isComment--456789Ten One -Supplemental node Knowledge:In the Document Object Model (DOM), each n
cookies; separate)650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7E/6A/wKiom1b-McSBpJIsAAIXjhZfLcI405.png "title=" Web.png "alt=" Wkiom1b-mcsbpjisaaixjhzflci405.png "/>The life cycle of a Cookie-If the Expires attribute is not specified, the cookie created is actually saved in memory, and the browser is destroyed when it is closed.-You can use expires to specify its life cycle when saving cookies650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7E/66/wKioL1b-M2Wwwj9RAAG1gUA
the address of the current pageWindow.location.href= "http://www.baidu.com"; Change page address, will jump pageWindow.location.hostname: Host name, domain name, site name, available variable receiveWindow.location.pathname: path name, available variable receiveV. Window.status objectsstatus bar to add text to displayWindow.status= "What to display in the status bar"; Set the status bar textAdd:The difference between a carriage return \ R and a newline character \ n: \ r equals Enter, which is
, which is used to represent a separate part of the document in an abstract way, and all other types inherit from it.2) The document type represents the entire documentation, which is the root node of a set of hierarchical nodes in JS, the Document object is an instance of the document type.3) The element node represents all HTML or XML elements in the document.4) Additional node types that represent text content, annotations, document types, and so on.The operation of accessing the
: Confirmation Box prompt: prompt Box Basic syntax: data type (string, Decimal, Integer, Boolean, time) var , var s = "3.14"; var n = parsefloat (s);; s + = 5; var d = parseint (s); IsNaN ( string ) : A string that determines whether it is a digital shape, is -false -true Operator: Four types of expression: Statement: three major classes (order, branch, Loop) Branch: if () {}; If...else ...; If...else if...else If ... else;if nested Loop: Exhaustive, iterative; four elements
Box prompt: prompt BoxBasic syntax: Data type (string, Decimal, Integer, Boolean, Time)var,var s = "3.14";var n = parsefloat (s);; s + = 5;var d = parseint (s);IsNaN (string): A string that determines whether it is a digital shape;-false; not-trueOperators: Four categoriesAn expression:Statements: three major classes (sequential, branching, looping)Branch:if () {}; If...else ...; If...else if...else If ... else;ifNestingCycle: exhaustive, iterative; four elements (initial conditions, cyclic co
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 values passed by the modal or non-modal dialog box.3. window.history ObjectWindow.history.back (); page back;Window.history.forward (); page forward;Window.history.go (n); n If a positive number represents the forward n pages, n is a negative number that represents back n pages, which is commonly used.4. window.
a function1. String functionsS.tolowercase ();---Variable lowercaseS.touppercase ();---Variable capitalizationS.SUBSTR (2, 8);--intercept starts at index 2, intercepts 8 character lengthsS.split ();--Specifies the character split, returning an array. Put a character in parentheses, divide s by this characters.length;--lengthS.indexof (); --The first occurrence in the string, looking for an index, no return-1.S.lastindextof (); --Find the first matching index from the back.2. Time-Date functionva
browsersFirstelementchildELEMENT nodes are identified in the Advanced browserIn a low-level browser is undefinedLastChildLastelementchildPreviousSiblingPreviouselementsiblingNextSiblingNextelementsibling2 Creating elementsDocument.createelement (' tag name ')Note: must be created under document3 inserting elementsParent. appendchild (Child)Parent. Insertbefor (who to put, who to insert before)Note: the parent. Insertbefor (who, NULL) is executed by default AppendChild4 Deleting an elementParent
Dom manipulation of JavaScriptThe basic concept of DOMDom is the Document Object model, which is a tree model; a document refers to a label document; An object is a document; A model refers to something that is abstracted.Windows Object OperationsProperties and MethodsProperty (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
instances.Htmlcollection:getelementsbytagname,getelementsbyclassname,getelementsbytagnamens, Document.forms and so on are returning htmlcollection instances.NamedNodeMap: Represents a collection of attribute node objects, Ele.attributes returns NAMEDNODEMAP instancesQueries that run in real time when the DOM document is accessed, so the following code causes an infinite loop.var divs = document.getelementsbytagname (' div '), I,div; for (i = 0;i) {
function to pass in a formal parameter, in the function inside the operation is not OK, but life is not ten. Added after each time regardless of the number of users to click on the Reply button, will be in the area of the first user to appear in the text box, after half a day and there is no egg use, so I think of a very magical method, rather let the formal parameter along the scope of the chain to find the parent node and then go down, to find the current function Replay (o) { var
1. Selection of DOM elementsSummed up mainly these severalRun effectThe above are all direct lookups, the following are indirect lookupsParentNode //parent node childnodes// All child nodes FirstChild //first child node LastChild //Last child node nextsibling // Next sibling node previoussibling //Previous sibling node these are parentelement //parent node tag elements that contain text childr
: Confirmation Box prompt: prompt Boxbasic Syntax: Data type (string, Decimal, Integer, Boolean, Time)Var,var s = "3.14"; var n = parsefloat (s);; s + = 5;var d = parseint (s);IsNaN (string): A string that determines whether it is a digital shape;-false; not-trueoperators: Four categoriesAn expression:statements: Three major classes (sequential, branching, looping)Branch:if () {}; If...else ...; If...else If...else If ... else;ifNestingcycle: Exhaustive, iterative; four elements (initial condit
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.