extjs特殊用法--js--呼叫變數方法定義前提最先變數要用var定義

瓜瓜東西發表於2014-07-16

引用js檔案,寫在jsp檔案中不可以--其實也可以,切記 先定義方法,後再呼叫,js畢竟不太智慧





var wj=function()
{
return {
hello:function(){

alert("wj");
}

};
}();


 wj.helloa=function()
{
return {
hello:function(){

alert("wj");
}

};
}();


jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!-- 引入extjs的css樣式檔案 -->
<link rel="stylesheet" type="text/css"
href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/bootstrap.js"></script>
<script type="text/javascript" src="extjs/promotionParticipants.js"></script>
<script type="text/javascript" src="extjs/promotionRequest.js"></script>
<script type="text/javascript">
Ext.onReady(function() {


//Ext.Msg.alert('提示', '逗號分隔引數列表');
Ext.MessageBox.alert("a", "b");

function test()
{
var currentstate = "THIS_IS_OK";
alert(currentstate);
}



});
//participantTablePanelHandler.loadParticipantsTable();
//wj.hello();

wj.helloa.hello();
</script>
</head>
<body>

</body>
</html>

相關文章