<script> window.onload = function (ev) { var vcar = new Car("大众","宝莱",60,1.6); vcar.startup(); vcar.Startengine(); vcar.changeSpeed(); vcar.swerve(); vcar.stop(); vcar.Turnofftheengine() } function Car(make, model, currentSpeed, displacement) { var currentSpeed = currentSpeed; this.startup = function () { document.write("启动:0"); }; this.Startengine = function () { var speed = currentSpeed; document.write("<br>" + "启动引擎:" + speed); }; this.changeSpeed = function () { var speed = currentSpeed*3/2; document.write("<br>"+"加速:"+speed); } this.swerve = function () { var speed = currentSpeed/3; document.write("<br>"+"转向:"+speed); } this.stop = function () { var speed = 0; document.write("<br>"+"刹车:"+speed) } this.Turnofftheengine = function () { var speed = currentSpeed/10; document.write("<br>"+"关引擎:"+speed) } } </script>