创建一个对象
script type="text/javaScript" var newObject=new Object(); //创建一个对象newObject.firstName="frank";//增加一个firstName属性newObject.sayName=function(){alert(this.firstName);} //添加一个sayName方法//调用sayName方法//newObject.sayName();//newObject["sayName"]();var FirstName=newObject["firstName"];var whatFunction;//if(whatVolume==1){//whatFunction="sayName";//}else if(whatVolume==2){//whatFunction="sayLoudly"//}//newObject[whatFunction]();function sayLoudly(){alert(this.firstName.toUpperCase());}newObject.sayLoudly=s...[ 查看全文 ]2016-02-20 标签: