廉颇老矣,尚能饭否

java:从技术到管理

常用链接

统计

最新评论

ExtJS学习(2):事件

shijian.jsp文件,代码1
<%@ page language="java" contentType="text/html; charset=UTF-8"
 pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Ext welcome you</title>

<link rel="stylesheet" type="text/css"
 href="extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript"
 src="extjs/build/locale/ext-lang-zh_CN.js"></script>

<script>
function a(){
 alert('aaaaa thing');
}
function b(){
 alert('bbbbb thing');
}
Ext.onReady(function(){
 Ext.get("btnAlert").addListener("click",a);//两种方式:addListener或on
 Ext.get("btnAlert").on("click",b,this,{delay:2000});//延迟加载
 }
);
</script>

</head>
<body>
<form action="">
<input id="btnAlert" type="button" value="Extjs  shijian" />
</form>
</body>
</html>

shijian.jsp文件,代码2

<%@ page language="java" contentType="text/html; charset=UTF-8"
 pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Ext welcome you</title>

<link rel="stylesheet" type="text/css"
 href="extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript"
 src="extjs/build/locale/ext-lang-zh_CN.js"></script>

<script>
Ext.onReady(function(){
 var win=new Ext.Window({
  title:"不能关闭的窗口", 
  height:200, width:300
    });
  win.on("beforedestroy",
    function(obj){
     alert("想关闭我,这是不可能的!");
     obj.show();
     return false;}); 
  win.show();
  }
);

</script>

</head>
<body>

</body>
</html>

shijian.jsp文件,代码3

<%@ page language="java" contentType="text/html; charset=UTF-8"
 pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Ext welcome you</title>

<link rel="stylesheet" type="text/css"
 href="extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript"
 src="extjs/build/locale/ext-lang-zh_CN.js"></script>

<script>

Ext.onReady(function(){  
 var win=new Ext.Window({ 
  title:"不能关闭的窗口", 
  height:200, width:300, 
  listeners:{"beforedestroy":
   function(obj){
    alert("想关闭我,这真是做梦!");
    obj.show();
    return false;
    }}  
 });  
 win.show();
 }
);


</script>

</head>
<body>

</body>
</html>




柳德才
13691193654
18942949207
QQ:422157370
liudecai_zan@126.com
湖北-武汉-江夏-庙山

posted on 2009-01-19 09:44 liudecai_zan@126.com 阅读(886) 评论(0)  编辑  收藏 所属分类: ExtJS


只有注册用户登录后才能发表评论。


网站导航: