<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<script type="text/javascript">
//closer
var car
= function(carName) { this.name = carName;
this.species = "good";
this.print = function() {
alert(this.species+","+this.name);
}
}
//JSON 형태
var
car= function(carName) { this.name = carName;
}
car.prototype = {
species :"good",
print:function() {
alert(this.species +","+this.name);
}
}
//prototype
var
car= function(carName){ this.name = carName;
}
car.prototype.species = "good";
car.prototype.print = function(){
alert(this.species +","+this.name);
}
window.onload = function() {
var defineObj = new DefineObj("JavaScript");
defineObj.print();
}
</script>
<title>DOM Demo</title>
</head>
<body>
<div id="defineObj"></div>
</body>
</html>