ExtJS Example 1

Source: Internet
Author: User
Tags autoload

1. Create a EXTJS window, request HTML files with Ajax, and execute HTML code and scripts

The text in the form is taken from one HTML, and the script is executed in HTML to highlight the form for 1 seconds

Main Page:

<!DOCTYPE HTML><HTML>    <Head>        <Linkrel= "stylesheet"type= "Text/css"href=".. /.. /extjslib/resources/css/ext-all.css " >ExtJS Style<Scripttype= "Text/javascript"src=".. /.. /extjslib/adapter/ext/ext-base-debug.js "></Script>ExtJS Base Library<Scripttype= "Text/javascript"src=".. /.. /extjslib/ext-all-debug-w-comments.js "></Script>ExtJS Component Library<Scripttype= "Text/javascript">Ext.blank_image_url= ".. /.. /extjslib/resources/images/default/s.gif"; //placeholder pictures, which should be specified before the app code executes        </Script>        <Scripttype= "Text/javascript"src= "Autoload.js"></Script>    </Head></HTML>

This note JS loading sequence, if the foundation to first load, do not write the reverse, resulting in JS error, for a glimpse of the person, each JS library has the corresponding debug footsteps

Autoload.js

functionBuildwindow () {varWin =NewExt.window ({//Create a Window instanceID: ' Mywindow ',//instance ID, which can be queried by the ext.getcmp methodTitle: ' Window Demo AutoLoad ', Width:300, Height:150, layout:' Fit ',//layout to fill a window with the contents of the formautoload:{//Auto LoadURL: ' sayhi.html ',//loads the page URL, where only HTML fragments are displayedScriptstrue//Execute Load page script, but execute block and row level scripts        }    }); Win.show ();//Display window}ext.onready (Buildwindow);//the Onready method is performed before the picture is loaded after the DOM is ready

Sayhi.html

<div>hello from the <b> world</b> of Ajax</div><script type= "Text/javascript" >     function  Highlightwindow () {        var win = ext.getcmp (' Mywindow ');   Get window instance        var winbody = win.body;           winbody.highlight ();    }    Highlightwindow.defer (1000); // execute </script> after 1 seconds

The highlight here is defer, which is more convenient than settimeout because

1. Simpler, any function can do this, just pass a time

2. You can control the methods that are deferred and the scope of execution, and pass in the set parameters (the exact words, not quite understood)

ExtJS Example 1

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.