日期:2014-05-16 浏览次数:20440 次
var TestCls = (function () {
//类定义
function TestCls() {
this.name = "TestCls类";
}
function show() {
alert(this.name);
}
TestCls.prototype = {
show: show
};
return TestCls;
})();
<html>
<head>
<title>测试</title>
<script src="TestCls.js" type="text/javascript"></script>
<script type="text/javascript">
var obj = new TestCls();
obj.show(); //VS能够智能提示到这个方法
</script>
</head>
<body>
</body>
</html>