prototype

来源:互联网 发布:暗黑战神 源码 网盘 编辑:程序博客网 时间:2024/04/28 23:30

  1. <script type="application/x-javascript">
  2.  fun=function()
  3.  {
  4.   var obj = document.getElementById("kkl");
  5.  }
  6.  fun.prototype={
  7.   funClick:function()
  8.   {
  9.     alert("good morning!");
  10.   }
  11.  }
  12.  startFun=function()
  13.  {
  14.   var funObj=new fun();
  15.   funObj.funClick();
  16.  }
  17. </script>
  18. <button label="call_3" oncommand="startFun()" />
fun.prototype为fun的原型增加方法和属性,从而fun也就具有了这些方法和属性

原创粉丝点击