这是《JavaScript学习源代码》一书的源代码

源代码在线查看: object.js

软件大小: 174 K
上传用户: mpeg2000
关键词: JavaScript 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				// create a new car object
				var car = new Object();
				
				// add some properties to the car object...
				car.maker = "Dodge";
				car.model = "Viper";
				car.color = "Silver";
				
				// display all the car object's property values...
				alert( car.color + " " + car.maker + " " + car.model );
				
				
				// add a method to the car object...
				car.startup = startup;
				
				// define the startup method...
				function startup()
				{
				  alert("... the motor is now running!");
				}
				
				
				// call the car object's startup method...
				car.startup();
				
				//-----------------------------------
				// You can also create a new instance of the car object like this...
				
				// var van = new Object(car);
				// van.model = "RAM day van";
				// van.color = "Blue and White";
				
				// alert(van.color + " " + van.maker + " " + van.model );
							

相关资源