* Curriculum review:
* JS Syntax
* JS dynamic function and anonymous function
* JS Dynamic functions functionnew function ();
* Anonymous function: A function without a name, a name
var add = function () {
};
* Global variables and local variables in JS
* All variables: Define the variables in the <script> tags and get them anywhere on the page.
* Local variables: Variables defined inside a method
* JS Objects and APIs
* String Object
* Properties: Length
Method
* and HTML related methods
* Bold () boldface
* FontColor () font color
* SUP () superscript
* SUB () subscript
* methods similar to String in Java
* CHARAT () returns the character at the specified position
* IndexOf () returns the position of the character
* SUBSTRING (start,stop) intercept string
* SUBSTR (start,length) Intercept string
* Array Arrays
* Declaring arrays
* var arr = [22];
* var arr = new Array (4 or "abc");
Method
* CONCAT () Link array or element
* POP () Delete last element, return
* PUSH () Adds an element to the end, returning the length.
* Sort () Order
* Date Object
* var date = new Date (); Current time
Method
* toLocaleString () show local date format
* getFullYear () get year
* GetMonth () Get month (0-11) +1
* GetDate () date
* GetDay () Days of the week
* GetTime () millisecond value
* SetTime () Set the time based on the millisecond value
* Date.parse (); Can string, return is millisecond value
* Math Maths
* Rounding on Ceil ()
* Floor () rounding
* Round () rounding
* Random () number
* RegExp Object
* New RegExp ("")
* var reg =/^ expression $/; (remember)
* Reg.test (string); (remember) if the match returns true if the match does not return false successfully.
* Global Functions
* Eval () parse the string and execute the JS code.
* IsNaN () determines whether a non-numeric value
* parseint ()
* BOM Browser object model
* Winodw Window Object
* Alert () Prompt box
* Confirm () Inquiry box
* SetInterval ("Run ()", 3000) executes the Run method every 3 seconds, returning a unique ID value
* SetTimeout ("Run ()", 3000), 3 seconds after executing the Run method, returns a unique ID value
* Clear Timer
* Clearinterval (ID)
* Cleartimeout (ID)
* Open ("", "", "") Popup new Window
* Close () Closes the window
* Navigator and browser version related
* Properties
* History and historical relevance
* Back () previous page
* Forward () Next
* Go (1 or-1)
* Location and address related
* href= "" Get and set links
=============================================================================================================== ================
* DOM Document Object model
* Documentobjectmodel
* Documentation: Tagged document (html/xml)
* Object: Encapsulation Properties and Behavior (method)
* Model: The embodiment of common features
* DOM parsing HTML
* All HTML (elements (tags), text, attributes) are encapsulated as objects by Dom method.
<span id= "Spanid" > Text </span>
* Dom wants to manipulate the tagged document first parsing. (parser)
* DOM parsing HTML (browser can HTML)
* Browser DOM parsing HTML?
* Three levels of DOM:
* DHTML is not a programming language.
* HTML: Encapsulates data. <span> data presented to the user </span>
* CSS: Set style (display effect)
* DOM: Manipulating HTML (parsing HTML)
* JS: Provide logic (Judgment statement, Loop statement)
* Document: Represents the entire documentation.
Method
getElementById ("Value of id"); Gets the element (label) object through the attribute of the element's ID.
Getelementsbyname ("Name attribute value"); Gets the collection of element objects by name (returns an array)
getElementsByTagName ("tag name"); Gets the collection of element objects by tag name (returns an array)
* Write ("text content (HTML tag)") writes the text to the browser.
* createelement ("element name"); Create element Object
* createTextNode ("text content") to create a text object
* AppendChild ("child node") Add child nodes
<span id= "" ></span>
* Element Object
* Get Element Object
* GetAttribute ("attribute name"); Gets the value of the property
* SetAttribute ("attribute name", "Value of attribute"); Set or modify the value of a property
* RemoveAttribute ("attribute name"); Delete attribute
* Gets all child nodes under the element (* * * * *)
* Ul.getelementsbytagname ();
* Node: Nodes object
* NodeName: Node name
* NodeType: Node type
* NodeValue: The value of the node
* ParentNode Gets the parent node (always an element node)
Ie6-8??????????????????????? ie9-11 Chrome FireFox
FirstChild first node???????? Firstelementchild? First node
LastChild last node,??????? Lastelementchild last Node
NextSibling Next sibling node????????????? next sibling node
PreviousSibling on a sibling node????? previouselementsibling? previous sibling node
<ul>
<li> Beijing </li>
</ul>
* If you get Beijing's sub-node through UL, use is ul.firstelementchild; get a child node in Beijing (ie9-11 Chrome FireFox)
* But if ie6-8, need to use firstchild;
<span id= "Spanid" >
Text content
</span>
* Use the tag of span to get the text content (also object) in the middle of span, need to use firstchild; (no matter what browser)
* Method
* HasChildNodes () Check if child nodes are included
* HasAttributes () Check if property is included
* APPENDCHILD (node) parent node called, adding child nodes at the end
* InsertBefore (New,old) parent node called to add child nodes before the specified node
* ReplaceChild (New,old) parent node call, replace node
* REMOVECHILD (node) parent node call, delete node
* CloneNode (Boolean) is not a parent node call, copy node
* Boolean: If True, the child node is copied
: If False, the child node is not copied, the default is False
* InnerHTML: Gets and sets the text content.
* innerHTML Properties:
* Get text content
* Set text content
Event
OnClick Click event
OnLoad Load Event
Onfocus Getting focus Events
Onblur Lost Focus Event
* Full selection/No selection/inverse selection Exercises
<input type= "checkbox"/>
* Specify default value: Checked as soon as it appears in <input type= "checkbox"/> the checkmark is ticked.
* Mouse Movement Events
OnMouseMove
onmouseout
onmouseover
* Mouse Click event (* * * * *)
OnClick Click
OnDblClick Double-click
* Loading and unloading
* ONLOAD (* * * *) Loading
* OnUnload Uninstall
* Get focus and lose focus (* * * * *)
* Onfocus Get focus
* Onblur loses focus
* Keyboard
* OnKeyUp Press to lift up
* Change Event (* * * * *)
* onchange
* Control the submission of the form (* * * * *)
OnSubmit
Job
* InsertBefore (new,old) Add child nodes before the specified node
* Add a child node before Shanghai
Day04-dom 168 Java EE Employment class