当前位置: 代码迷 >> Java Web开发 >> javascript继承代码
  详细解决方案

javascript继承代码

热度:192   发布时间:2016-04-17 01:02:34.0
javascript继承代码求助
Java code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title></head><body><script language="javascript">function ClassA(color){this.color = color;this.saycolor = function(){alert(this.color);};}function ClassB(color,name){this.newmethod = ClassA;this.newmethod(color);delete this.newmethod;this.name = name;this.sayhi = function(){alert(this.name);};}var obj1 = new classA("red");var obj2 = new ClassB("blue","as h");obj1.saycolor();obj2.saycolor();obj2.sayhi();</script></body></html>

请问哪错了

------解决方案--------------------
探讨

Java code

var obj1 = new classA("red");


'c'大写
  相关解决方案