Specific examples:
(1) Create a JSP file, introduce CSS and JS files, add three div
<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%><%string path = Request.getcontextpath () ; String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";%> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >(2) write ext fileExt.onready (function () {//ext.dom.element//ext.get uses a caching mechanism to improve the efficiency of getting a DOM node Ext.element//get description of the method:/** * 1 First go to the Ext.cache cache to find, if the cache has, directly return to * 2 if the cache is not, then go to the page to find, if not in the page, return NULL * 3 If the page has, add the current content to the cache: {ID: {data/events/dom} } * 4 Ext.addcacheentry added to the cache method */var D1 = ext.get (' D1 ');//ext.elementalert (D1.dom.innerHTML);//ext.fly/** * Fly: Use JavaScript's classic ' enjoy meta ' mode to increase efficiency, saving memory, and lower carbonization * returned objects: Fly object, of course you can understand that the return is the EXT package ext.element Object * Note: Fly due to the internal use of the element mode, so Only fits one operation, saving memory * /var d2 = ext.fly (' D2 '); var d3 = Ext.fly (' D3 '); D2.dom.innerHTML = ' AAA ' ; D3.dom.innerHTML = ' BBB '; /*//Note: The correct method should be the following var D2 = Ext.fly (' D2 '); D2.dom.innerHTML = ' AAA '; var d3 = ext.fly (' D3 '); D3.dom.innerHTML = ' BBB '; *///ext.getdom/** * Gets the element's DOM element directly from the page */var dom = ext.getdom (' D3 '); Htmlelementdom.innerhtml= "CCCC";});
(3) program operation resultthe result obtained by the Get method.
results of the Fly method
Results of the GetDOM method
ExtJS learn-------Ext to DOM operation: Ext.get ext.fly Ext.getdom