ArticleDirectory
Turn: http://www.webtiro.com/304.html
Here we will pick out what we think is commonly used:
1. Ext. Get
VaR El = ext. Get ('myelementid'); // get the element, equivalent to document. getelementbyid ('myelementid'); // Cache
2. Ext. Fly
VaR El = ext. Fly ('myelementid') // No cache is required.
Note: The flyweight Design Pattern mode is a memory-saving mode. The general principle of this mode is to create a single object and use it repeatedly.
Ii. CSS Elements
4. addclass
Ext. Fly ('elid'). addclass ('mycls'); // Add the 'mycls' style of the element
6. removeclass
Ext. Fly ('elid'). removeclass ('mycls'); // remove the element style
10. replaceclass
Ext. Fly ('elid'). replaceclass ('myclsa ', 'myclsb'); // Replace the style
12. setstyle
Ext. Fly ('elid'). setstyle ({
Display: 'block ',
Overflow: 'ddy ',
Cursor: 'pointer'
}); // Set the element style. You can also use an object parameter to include multiple styles.
30. appendchild
The child element of the input element.
VaR El = ext. get ('elid1'); // use ID to specify Ext. fly ('elid '). appendchild ('elid2'); // Ext. add Ext. fly ('elid '). appendchild (EL); // Add Ext. fly ('elid '). appendchild (['elid2', 'elid3 ']); // directly add the DOM node Ext. fly ('elid '). appendchild (El. dom); // Add compositeelement, a group of divext. fly ('elid '). appendchild (ext. select ('div '));
31. appendto
Add this element to the sent element.
VaR El = ext. get ('elid1'); // Add 'elid' to 'elid2' Ext. fly ('elid '). appendto ('elid2'); Ext. fly ('elid '). appendto (EL); // Add to Ext. element el
32. insertbefore
Input an element parameter and place it before the current element.
VaR El = ext. get ('elid1'); // insert ext in front of the DOM node. fly ('elid '). insertbefore ('elid2'); // Ext. insert Ext. fly ('elid '). insertbefore (EL );
33. insertafter
Input an element parameter and place it after the current element.
VaR El = ext. get ('elid1'); // insert Ext. fly ('elid '). insertafter ('elid2'); // Ext. element El inserts Ext. fly ('elid '). insertafter (EL );
34. insertfirst
You can insert an element or create an element (use the "domhelper configuration item object" as the parameter for creation). In short, this element is the first child element of the current element.
VaR El = ext. get ('elid1'); // The inserted Dom node acts as the first element Ext. fly ('elid '). insertfirst ('elid2'); // insert Ext. element is the first element Ext. fly ('elid '). insertfirst (EL); // use the domhelper configuration item to create a new node. The new node will be inserted as the first child element. Ext. Fly ('elid'). insertfirst ({Tag: 'P', CLS: 'mycls', HTML: 'Hi I am the new first child '});
38. inserthtml
Insert an HTML clip to this element. As for where the html to be inserted is placed in the element, you can specify beforebegin, beforeend, afterbegin, afterend. The second parameter is to insert an HTML clip, and the third parameter is to determine whether to return a DOM object of the Ext. Element type.
Ext. fly ('elid '). inserthtml ('beforebegin', '<p> <a href = "anotherpage.html'> click me </a> </P> '); // The Dom node ext is returned. fly ('elid '). inserthtml ('beforebegin', '<p> <a href = "anotherpage.html'> click I </a> </P> ', true); // return Ext. element
39. Remove
Remove the current element from the Dom and delete it from the cache ..
Ext. Fly ('elid'). Remove (); // The ELID is not included in the cache or Dom.
40. removenode
Remove the DOM node of the document. If it is a body node, it will be ignored.
Ext. removenode (node); // remove (htmlelement) from the DOM)