xiaohuli 2014-04-28
这是helloWorld.html
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Ext JS in Action Chapter 01 | Hello World Window</title> <link rel="stylesheet" type="text/css" href="./ext3/resources/css/ext-all.css" /> <script type="text/javascript" src="./ext3/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="./ext3/ext-all-debug.js"></script> <script type="text/javascript"> Ext.BLANK_IMAGE_URL = './ext3/resources/images/default/s.gif'; </script> <script type="text/javascript" src="./helloWorld.js"></script> </head> <body> </body> </html>
这是helloWorld.js
function buildWindow() { var win = new Ext.Window({ id : 'myWindow', title : 'My first Ext JS Window', width : 300, height : 150, layout : 'fit', autoLoad : { url : 'sayHi.html', scripts : true } }); win.show(); } Ext.onReady(buildWindow);
这是sayHi.html
<div id='fxDiv'>Hello from the <b>world</b> of AJAX!</div> <script type='text/javascript'> function highlightWindow() { var win = Ext.getCmp('myWindow'); var winBody = win.body; winBody.highlight(); } highlightWindow.defer(1000); </script>
scripts:true就是执行里面的JavaScript,highlightWindow.defer(1000);的意思就是延迟一秒钟调用highlightWindow函数