JS DOM---Two steps: 1 Find tags (1) Find document.getElementById directly ("Idname")//DOM Object Document.getelementsbytagna Me ("TagName")//collection of Dom objects [Dom1,dom2,..] Document.getelementsbyclassname ("name")//collection of Dom objects [Dom1,dom2,..] (2) Navigation find---Navigate to another label by one label Parentelement//parent node tag element children//All child tags Firstelementchild First child tag element lastelementchild//Last child tag element nextelementtsibling//Next sibling tag element previouselementsibling//previous brother LABEL element 2 Action label (1) Text Action Value operation: Dom object. Innertextdom object. InnerHTML assignment: Dom object. innerhtml= "Hello World" Dom object . innertext= "Hello World" (2) attribute operation DHTML's Concise Syntax: Console.log (DOM object. Attribute name); Dom object. property = value Native JS:console.log (DOM object. getattribute ("attribute name")) Dom object. SetAttribute ("Property name", "value") Value:input,sele CT, textarea (3) class properties manipulate DOM objects. Classlist.add ("Hide"); Dom object. Classlist.remove ("C1"); Left menu Instance (4) CSS style set DOM object. Style. Styles property = style Value node Action 1 Create node doCument.createelement ("a"); 2 Add node parent node. appendchild (Add node) 3 Delete node parent node. removechild (child node) 4 Replace node parent node. replacechild (new node, replaced node) Event onclick Click event OnDblClick Double click event OnLoad event onsubmit event block default event occurrence: Return Falseonkeydown event onselect Event onmouseover Thing Thing
DAY15 JSS Overall structure carding