比如说显示一个消息框:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ExtJS2.0测试</title>
<link rel="Stylesheet" href="resources/css/ext-all.css" />
<script type="text/javascript" src="adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="js/ext-all.js"></script>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
// Ext.onReady(function() {
// alert("Congratulations! you have ExtJS configured successed!!");
// })
Ext.MessageBox.show({
title: "标题",
msg: "内容的消息",
buttons: { "ok": "我不再显示OK了" },
fn: function(e) { alert(e); },
animEl: "test1",
width: 500,
icon: Ext.MessageBox.INFO,
closable: false,
progress: true,
wait: true,
progressText: "进度条"
// prompt:true
// multiline:true
});
</script>
</body>
</html>
首先,注意引入.js脚本的引入顺序
<script type="text/javascript" src="adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="js/ext-all.js"></script>
及其正确的目录; 否则可能会遇到"Ext未定义"等问题
其次,Ext.MessageBox.show()放在<body>里;