您现在的位置: 365建站网 > 365文章 > javascript类的定义

javascript类的定义

文章来源:365jz.com 点击数:204 更新时间:2009-09-19 10:23
<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>

生产内容,同时打通搜索引擎(SEO)与AI搜索引擎(GEO)流量入口的软件! 点击进入365建站器 »

您可能感兴趣的文章