<html>
<head>
<script>
function Color(r, g, b) {
this.Red = r;
this.Green = g;
this.Blue = b;
}
myColor = new Color(10, 20, 30);
// Prints out: "Red: 10"
alert("Red: " + myColor.Red);
</script>
<title>test</title>
<body>
aaaa
</body>
</html>
原文:
http://tech.pro/tutorial/648/javascript-objects-a-useful-example