ExtJS learn-------Ext to DOM operation: Ext.get ext.fly Ext.getdom

Source: Internet
Author: User






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 file

Ext.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 result

the 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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.