Ext 入门的简单messageBox DEMO


<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<% String path = request.getContextPath(); %>
<html>
<head>
<title>My JSP 'ExtHello.jsp' starting page</title>
<link rel="stylesheet" type="text/css" href="<%=path %>/ext-2.2/resources/css/ext-all.css">
<script type="text/javascript" src="<%=path %>/ext-2.2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=path %>/ext-2.2/ext-all.js"></script>
<script type="text/javascript" src="<%=path %>/ext-2.2/source/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%=path %>/ExtJsDemo/hello.js"></script>
</head>
<body>
</body>
</html>


Ext.onReady(function(){
// ① 小谈 JSON
// 定义json对象
var jsonObject = {
name:'chengYu',
age:25,
sex:'man',
books:[
{name:'ThinkInJava',price:107},
{name:'Ext之旅',price:59}
]
};
// 获取json对象属性
// alert(jsonObject.name+" "+jsonObject.age+" "+jsonObject.books[0].name+" "+jsonObject.books[0].price);
// 遍历json集合
/*for(var i=0;i<jsonObject.books.length;i++){
alert(jsonObject.books[i].name+" "+jsonObject.books[i].price);
}*/
Ext.Msg.show(jsonObject);

// ② 信息提示框 组件基础

// Ext.Msg.alert('msgAlertTitle','这种配置很常见');
/* Ext.Msg.alert('msgAlertTitle','这种配置很常见',callback);
function callback(id){
alert(id);
}*/

/*Ext.MessageBox.confirm('删除用户','你确定删除吗?',delCallback);
function delCallback(id){
if (id=='yes') {
alert('删除成功');
} else {
alert('你选择了no');
}
}*/
// ------------------------------
// Ext.MessageBox 和 Ext.Msg 是相同效果的工具类
// Ext.Msg 是 Ext.MessageBox 的别名,只是提供了更简短的调用。
// ------------------------------
// alert('只能使用纯文本');
// Ext.MessageBox.alert('<font size=4 color=red>支持html格式文本的div</font>');

/*Ext.MessageBox.prompt('备注','请输入评语',promptCallback,this,true);
function promptCallback(id,msg){
alert('你单击的按钮:'+id+' 输入的内容:'+msg);
}*/

// 进度条
/*Ext.MessageBox.wait('please wait ...','提示',{
text:'进度条上的文字'
});*/

// ------------------------------自定义提示框
/*var config = { //定义配置对象
title:'msgShowTitle',
msg:'我的配置很简单,Ext.Msg.show()'
};
Ext.Msg.show(config);*/

/*Ext.MessageBox.show({
title:'标题',
msg:'我有三个按钮、一个多行文本区',
modal:true,
prompt:true,
value:'请输入',
fn:showCallback,
buttons:Ext.Msg.YESNOCANCEL,
icon:Ext.Msg.QUESTION

});
function showCallback(id,msg){
alert(id+" - "+msg);
}*/

// 改变默认按钮文本
/*Ext.MessageBox.buttonText = {
yes:'按钮一',
no:'按钮二',
cancel:'按钮三'
};
Ext.MessageBox.show({
title:'标题',
msg:'我有三个按钮、一个多行文本区',
modal:true,
prompt:true,
value:'请输入',
fn:showCallback,
buttons:Ext.Msg.YESNOCANCEL,
icon:Ext.Msg.QUESTION

});
function showCallback(id,msg){
alert(id+" - "+msg);
}*/

// 动态更新文本
/*var msgBox = Ext.MessageBox.show({
title:'title',
msg:'information',
modal:true,
buttons:Ext.Msg.OK
});
var task = Ext.TaskMgr.start({
run:function(){
msgBox.updateText('动态更新'+new Date().format('y-m-d g:i:s a'));
},
interval:1000
});
Ext.TaskMgr.start(task);*/

// progress
/*var myBox = Ext.MessageBox.show({
title:'title',
msg:'information',
modal:true,
width:300,
progress:true
});
var count = 0; //滚动次数
var percentage = 0; //滚动百分比
var progressText ='';//进度条信息
var myTm = Ext.TaskMgr.start({
run:function(){
count++;
if(count>10){
myBox.hide();
}
// 进度条进度
percentage = count/10;
progressText = '当前完成'+percentage*100+'%';
myBox.updateProgress(percentage,progressText,'当前时间:'+new Date().format('y-m-d g:i:s a'));
},
interval:1000 //1 second
});
Ext.TaskMgr.start(myTm);*/
// --------------------------------------------------------------------------------------
});


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值