<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>javascript类的定义</title>
<script type="text/javascript">
function Go(s){this.Init(s)};//创建类
Go.prototype={//定义属性与方法
step:0,
start:0,
kill:{b:0,w:0},//创建ArrayList
Rend:function(){
alert('Rend');
},
Init:function(s){
this.step=s;
}
}
function f(){
var g = new Go(1);
g.Rend();
alert(g.step);
alert(g.kill['b']);
}
</script>
</head>
<body>
<input type="button" value="ok" onclick="f();" />
</body>
</html>
<head>
<title>javascript类的定义</title>
<script type="text/javascript">
function Go(s){this.Init(s)};//创建类
Go.prototype={//定义属性与方法
step:0,
start:0,
kill:{b:0,w:0},//创建ArrayList
Rend:function(){
alert('Rend');
},
Init:function(s){
this.step=s;
}
}
function f(){
var g = new Go(1);
g.Rend();
alert(g.step);
alert(g.kill['b']);
}
</script>
</head>
<body>
<input type="button" value="ok" onclick="f();" />
</body>
</html>