Look at the code:
Html:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>index</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= "Ext-all.js" ></script>
<script type= "Text/javascript" src= "Index.js" ></script>
<script type= "Text/javascript" >
Ext.onready (MyNameSpace.app.init, Mynamespace.app);
</script>
<body>
<div id= "Mydiv" ></div>
<p id= "1" >1</p>
<p id= "2" >2</p>
<p id= "3" >3</p>
<p id= "4" >4</p>
</body>
Index.js content:
Copy Code code as follows:
/*
Author:binarytree
*/
Fill a local reference to a picture
Ext.blank_image_url = ' resources/images/default/s.gif ';
Name space
Ext.namespace (' MyNamespace ');
Creating an Application
Mynamespace.app = function ()
{
Return
{
Init:function ()
{
Alert (' Initialization of program completed ');
}
};
}();
Online index, wait until the following results: ECMAScript in some cases, you can perform automatic semicolon completion on JavaScript statements, return is one of them;
Certain ECMAScript statements (empty statement, variable statement, expression statement, Do-while statement, continue STA Tement, break statement, return statement, and throw statement) must is terminated with semicolons. Such semicolons may always appear explicitly in the source text. For convenience, however, such semicolons May is omitted from the source text in certain situations. These situations are described by saying, semicolons are automatically inserted into the source code token stream in T Hose situations.
In the 11th line of my index.js, the JavaScript parsing engine resolves to automatically complete the semicolon, which causes the following statement not to execute;
Workaround: Return the curly braces on the new line, avoid being automatically filled with semicolons;
Although very simple, but for me is one of today's knowledge; ^__^