求助,JavaScript问题,我写的页面不好使
想要实现的效果是,通过点击div中的内容,弹出alert框,但是现在点了之后没有任何反应,请帮我看看哪有毛病了<html>
<head>
</head>
<script type="text/javascript">
window.$=function(obj){return typeof(obj)=="string"?document.getElementById(obj):obj};
window.onload = function(){
var Class = {
create : function(){
return function(){
this.initialize.apply(this,arguments);
}
}
}
var Fight=Class.create();
Fight.prototype={
initializ:function(ko,punch){
this.ko=ko;
this.punch=punch;
}
dofight:function(){
alert(this.ko + "give you a deadly" + this.punch);
alert(this.ko + "cannot give me a deadly" + this.punch);
}
};
var doit;
$("div1").onclick=function(){
doit=new Fight("I","punch");
doit.dofight();
}
$("div2").onclick=function(){
doit=new Fight("you","kick");
doit.dofight();
}
}
</script>
<body>
<div id="div1">ko</div>
<div id="div2">punch</div>
</body>
</html>