<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>js面向对象</title>
</head>
<body>
<script type="text/javascript">
// alert(123);
window.οnlοad=function(){
// alert(123);
var obj=new test('张三','男');
alert(obj.sex);
obj.eat('牛肉');
}
function test(name0,sex0){
this.name=name0;
this.sex=sex0;
this.eat=function(food){
alert(food);
}
}
</script>
</body>
</html>