prototype 初学,undefined <script type="text/javascript"> //prototype属性 function Son() { //子类 var lastname = "sam"; } function Father() { //父类 var firstname = "Shen"; } Son.prototype = new Father(); alert(Son.firstname +" " +Son.lastname); </script>初学jS,哪错了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Son.prototype = {} 你重写了对象原型 导致son无法找到原型引用 function GetObj(objName) { if (document.getElementById) { return eval('document.getElementById("' + objName + '")'); } else { return eval('document.all'+objName); } }这句话干啥用的,啥意思 <script type="text/javascript"> function Son() { //子类 this.lastname = "sam";//这里用var 代表私有属性,只能Son类内部使用 } function Father() { //父类 this.firstname = "Shen"; } Son.prototype = new Father();//Son继承Father var son1=new Son(); //实例化Son对象 alert(son1.firstname +" " +son1.lastname); </script> jquery可以选择父页面中的元素吗 各位帮帮忙啊,ajax问题 关于Ext.window和iframe的问题 解决的话赏50!!! 关于javascritp的使用问题 同一个类中的两个对象,怎么会互相影响呢? 一个javascript赋值问题 关于 window.open的问题???????????!!!!!!!!!! submit为什么提交 JS关于行和列与控件的关系~?急!!!!` 麻烦大神看看,js 怎么验证一个地址是否包含省份、城市、区县和详细地址 HTML基础问题 javascript操作word表格的问题
你重写了对象原型 导致son无法找到原型引用
{
if (document.getElementById)
{
return eval('document.getElementById("' + objName + '")');
}
else
{
return eval('document.all'+objName);
}
}
这句话干啥用的,啥意思
function Son() { //子类
this.lastname = "sam";//这里用var 代表私有属性,只能Son类内部使用
}
function Father() { //父类
this.firstname = "Shen";
}
Son.prototype = new Father();//Son继承Father
var son1=new Son(); //实例化Son对象
alert(son1.firstname +" " +son1.lastname); </script>