ExtJS入门一例
比如说创建一个消息框:
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <title>ExtJS2.0测试</title> 6 <link rel="Stylesheet" href="resources/css/ext-all.css" /> 7 8 <script type="text/javascript" src="adapter/ext/ext-base.js"></script> 9 <script type="text/javascript" src="js/ext-all.js"></script> 10 </head> 11 <body> 12 <div id="container"></div> 13 <script type="text/javascript"> 14 // Ext.onReady(function() { 15 // alert("Congratulations! you have ExtJS configured successed!!"); 16 // }) 17 18 Ext.MessageBox.show({ 19 title: "标题", 20 msg: "内容的消息", 21 buttons: { "ok": "我不再显示OK了" }, 22 fn: function(e) { alert(e); }, 23 animEl: "test1", 24 width: 500, 25 icon: Ext.MessageBox.INFO, 26 closable: false, 27 progress: true, 28 wait: true, 29 progressText: "进度条" 30 // prompt:true 31 // multiline:true 32 }); 33 </script> 34 </body> 35 </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>里;