One of extjs study notes first recognized extjs's MessageBox

Source: Internet
Author: User

Create a new my directory, and all subsequent sample files will be created in this directory.
1. Hello world!
First look at all the hello World pages of extjsCode:

Copy code The Code is as follows: <HTML>
<Head>
<Title> extjs MessageBox </title>
<LINK rel = "stylesheet" type = "text/CSS" href = "../resources/CSS/ext-all.css"/>
<SCRIPT type = "text/JavaScript" src = "../adapter/EXT/ext-base-debug.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "../ext-all-debug.js"> </SCRIPT>
</Head>
<Body>
<SCRIPT type = "text/JavaScript">
Ext. blank_image_url = '../resources/images/default/s.gif ';
Ext. onready (function (){
Ext. MessageBox. Alert ('hello', 'Hello World ');
});
</SCRIPT>
</Body>
</Html>

The result is as follows:

Note that the sequence of JS files introduced above cannot be reversed, otherwise the correct results cannot be obtained. 2. Ext. MessageBox
Ext. MessageBox provides common prompt box functions. Ext. MSG is an object exactly the same as it, but its name is different. Ext. MSG has common alert, confirm, promt, show and other methods, which are very simple. The following is an example. Function parameters of extjs can be separated by a comma or an object with the parameter name: parameter value. The example below will also be shown.Copy codeThe Code is as follows: <HTML>
<Head>
<Title> extjs MessageBox </title>
<LINK rel = "stylesheet" type = "text/CSS" href = "../resources/CSS/ext-all.css"/>
<SCRIPT type = "text/JavaScript" src = "../adapter/EXT/ext-base-debug.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "../ext-all-debug.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
Function alertclick (){
Ext. msg. Alert ("alert", "hello ");
}

Function showoutput (s ){
VaR area = Document. getelementbyid ("output ");
Area. innerhtml = s;
}

Function confirmclick (){
Ext. msg. Confirm ('Confirm', 'Choose one please', showoutput );
}

Function promptclick (){
Ext. msg. Prompt ('propt', 'try enter something ',
Function (ID, MSG ){
Showoutput ('You pressed '+ ID + 'key and entered' + MSG );
});
}

function showclick () {
var option = {
title: 'box show',
MSG: 'This is a most flexible MessageBox with an info icon. ',
modal: True,
buttons: ext. MSG. yesnocancel,
icon: ext. MSG. info,
FN: showoutput
};
Ext. MSG. show (option);
showoutput ("Hi, a box is promting, right? ");
}< br>



alertbutton


confirmbutton


promptbutton


showbutton



the parameters of MSG methods are similar. They are used to set the title, prompt language, and button settings. Note that the message box of MSG is different from the default prompt box of JavaScript. Its pop-up does not prevent execution of other codes. To execute some code after the pop-up box is closed, you must input a function FN to it. The last example clearly shows this. After a prompt box is displayed, the following code is still executed. When the pop-up box is closed, the showoutput function is executed:

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.