js学习(六)- js对象创建

//---------------------js文件---------------------

var namespace02=new Object();
  namespace02.Person=function(arg0,arg1,arg2){
  this.name=arg0;
  this.age=arg1;
  this.sex=arg2;
  this.showInfo=function(){
    alert(this.name+","+this.age+","+this.sex);
  }
}

//---------------------html文件---------------------

<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="js/Person.js"></script>

<script type="text/javascript">

var p2 = new namespace02.Person("1","2","3");
p2.showInfo();

</script>
</head>
<body>

</body>
</html>

上一篇:cnn神经网络入门


下一篇:mssql sqlserver 优化注意事项: