<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GBK"> <title>Untitled Document</title> </head> <body> <script type="text/javascript" src="jstool.js"></script> <script type="text/javascript"> /*function person(){ print("person run"); } var p=new person(); p.name="zhansan"; p.age=33; p.show=function(){ print("__"+this.name+"__"+this.age); } p.show(); */ /* function person(name,age){ this.name=name; this.age=age; this.getname=function(){ return this.name; } } var p=new person("zhansan",33); print(p.getname()); */ var pp={ "name":"zhansan","age":33, "getname":function(){ return this.name; } } print(pp.name); //对象成员有两种方式 print(pp["age"]+":"+pp.name); var map={ 3:"xiaoqiang",4:"xiaozhang",5:"xiaoeri" } var vall=getkey(3); print(vall); function getkey(key){ return map[key]; } var myobj={ myname:"xiaoming",myage:44 } print(myobj.myname+"__"+myobj.myage+"_"+myobj["myage"]); var myobj1={ "myname":"xiaoming","myage":44 } var myobj2={ myarray:[3,4,2,4,22,34,34] } print(myobj2.myarray[3]); var mymap={ names:[{name1:"战三"},{maname:"小花"}] } print(mymap.names[0].name1); </script> </body> </html>