W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<html> <body> <script type="text/javascript"> function createCar() { var oTempCar = new Object; oTempCar.color = "blue"; oTempCar.doors = 4; oTempCar.mpg = 25; oTempCar.showColor = function() { document.write(this.color); }; return oTempCar; } var oCar1 = createCar(); var oCar2 = createCar(); oCar1.showColor(); document.write("<br />") oCar2.showColor(); </script> </body> </html>