extJs 事件处理程序不显示效果
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Extjs事件处理</title>
<link rel="stylesheet" type="text/css" href="../ext/resources/css/ext-all.css" />
<script type="text/javascript" src="../ext/ext-all.js"></script>
<script type="text/javascript" src="../ext/ext-lang-zh_CN.js"></script>
<script type="text/javascript">
var hello=Ext.get('hello');
var clickHandler=function(event,eventTarget){
Ext.MessageBox.alert("click","你click"+eventTarget.id)
};
hello.on('click',clickHandler);
</script>
</head>
<body>
<h1><div id="hello"/>测试</div></h1>
</body>
</html>
------解决方案--------------------Ext.onReady(function() {
var hello=Ext.get('hello');
var clickHandler=function(event,eventTarget){
Ext.MessageBox.alert("click","你click"+eventTarget.id)
};
hello.on('click',clickHandler);
});