`

js对象封装

    博客分类:
  • js
 
阅读更多
<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<script type="text/javascript" src="jquery-1.8.2.js"></script>
	<script type="text/javascript" src="main.js"></script>
	<script type="text/javascript" src="a.js"></script>
	<script type="text/javascript" src="b.js"></script>
	<script type="text/javascript">
		$(function() {
			
			main.a.hello();
		});
	</script>
</head>
<body>

</body>
</html>


window.main={};


main.a=(function(){
	function hello(){
		alert('a.js');
	}

	return {
		hello: hello
	}
}());

main.b=(function(){
	function hello(){
		alert('b.js');
	}

	return {
		hello: hello
	}
}());

 

  • 大小: 135.9 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics