namespace.js 代码:
Ext.namespace("simp.namespace"); //设置命名空间;
simp.namespace.person = Ext.emptyFn;
Ext.apply(simp.namespace.person.prototype,{name:"namespace",id:1});
引入页,代码:
<!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=gb2312">
<title>无标题文档</title>
<script src="../ext-all.js"></script>
<script src="../adapter/ext/ext-base.js"></script>
<script src="nameSapce.js"></script>
<script>
var person = new simp.namespace.person;
alert(person.name + " " + person.id);
person.name="haha";
person.id=2;
alert(person.name + " " + person.id);
</script>
</head>
<body>
</body>
</html>