Discover javascript dom manipulation, include the articles, news, trends, analysis and practical advice about javascript dom manipulation on alibabacloud.com
, 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
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
() hasclass ( )//returns a Boolean value equivalent to IS (". ClassName")//css-dom operation, but appears in the presentation layer, using class insteadCSS ()//usage with attr (), quoted, "-" with hump-type replacementcss"Opacity","0~1")//Set Transparencyheight ()/width () height ( -)/height ("10em")//default unit pxoffset (). Left/top position (). Left/topscrolltop ()/scrollleft ()//distance from top and left of scroll barV. Getting and setting HTML
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
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
Html:1. Do not use document.write when the document is loaded, this will create a new DOM object and the original element will be overwritten.2, the acquisition of elements, through the getElementById; Getelementbytag ("P") (first of the same element)3. Change the attribute. getElementById (' id '). href= "www.baidu.com";Css:1. Syntax document.getElementById (ID). Style.property = new Style; document.getElementById (' divID '). Style.width = ' 50px
the DOM operation of JSDom:document Object ModelBom:bowers (browser) Object ModelFind the element: Var A=document.getelementbyid ("id"), put the found element in the variable;ID selector: document.getElementById ("id"), according to the ID, find at most one;Class selector: Document.getelementclassname ("name"), according to ClassName, find out the array;Tag Selector: document.getelementtagname ("name"), based on the name of the tag, find the array;Nam
Dom:123456 - - + - + A at - - - - - the -Jquery:1234567 - + - + A at - - - - - in - to + - the * $Panax Notoginseng - the + A the - $DOM manipulation and jquery implementation options move operations
JQuery's operations on the DOM are also very important. 1. Three simple and practical jQuery methods for DOM operations: text ()-Sets or returns the text content of the selected element HTML ()-Sets or returns the selected Element (including HTML markup) val ()-Sets or returns the value of the form field 2.attr () Get Properties . Of course, these two can also set their own values to modify,
element propertiesFor standard attributes such as: ID, event, SRC, and so on. Assign a value directly with a propertyFor non-standard attributes: class, and so on. Use the following method:,GetAttribute () SetAttribute () Hasattribute () RemoveAttribute ()6element.textcontent//can be used to set plain text7. Modify the document treeCreate node: document.createelement () createTextNode ()Insert Node Parent.appendchild (chid) Parent.insertbefore (Child,parent.childnodes[n])//If the child is in th
The general jquery in the Web project as long as the function is to value and assignment.Below are the Getting started, these are worth getting. JQuery (iii) DOM manipulation
Difference:
Javascript
JavaScript is the most popular browser scripting language on the Internet. It's easy to use! You're going to love it!
JavaScript is used by millions of of pages to improve design, validate forms, detect browsers, create cookies, and apply more.
HTML DOM
The HTML
JavaScript web pages-DOM and javascript-dom
I. Full name of DOM
Document Object Model)
Ii. What is DOM?
DOM is a programming interface and an API.DOM is an API for HTML documents and XM
Setting styles with DomElement.style.property = valueWhen to set a style with a DOM scriptThe author writes: The vast majority of modern browsers, although the support of the CSS pseudo-class is not very complete, but has good support for the DOM, so need to consider is the problem of the simplest solution is what, which solution will be more browser support.After trying the example of
In this chapter I mainly introduce the first-level dom of the web, which has been supported by a new generation of browsers. Make a general understanding of his work and let you know what you can do to them.
First, there are some suggestions for DOM and the purpose of DOM design, and then I'll show you what a node is (nodes) and how to traverse a node through a
JavaScript Summary-DOM, javascript-dom
For Web Front-end development, three parts are in the final analysis:
Structure: HTML
Performance: CSS
Behavior: JavaScript
In terms of behavior, JavaScript performs operations on
, a complete JavaScript implementation was made up of three distinct parts
The Core (based on ECMAScript spec)
The Document Object Model (DOM)
The Browser Object Model (BOM)
ECMAScriptA Web browser is considered a host environment for ECMAScript, but it's not the only host environment. A List of other host environments listed here.Apart from
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.