jQuery.fn = jQuery.prototype = {
constructor: jQuery
}上边这种写法跟
jQuery.prototype.fn={
constructor: jQuery
}
有区别吗 ,等号后面直接写个大括号是匿名函数?
constructor: jQuery
}上边这种写法跟
jQuery.prototype.fn={
constructor: jQuery
}
有区别吗 ,等号后面直接写个大括号是匿名函数?
解决方案 »
- JS如何判断文本框输入的字符串长度
- 请问如何动态增加表格?我想一次增加几行,而不是一行一行
- 帮我看看这段代码能不能增加个限制上传图片大小
- js无法向父窗口传值,Untitle.html与a。html可以获取,Untitle。html与ShowPart_interface.jsp无法获取,而a.html的代码就是....
- 请牛人帮我看看这段代码为什么不能显示效果
- 为什么style.height修改了后offsetHeight不会变
- 在线,javascript检测一个activex是否安装
- 关于弹出提示框的问题?急
- 急!Treeview控件问题
- javascript可以获得URL请求返回的错误信息么?
- 请教下kindeditor的问题
- 嵌入进html中的javascript语句怎么不起作用?
return funciont(){};//这个function是匿名函数
}
那我如何调用constructor 这个东西呢?jQuery.prototype 这个prototype 是不是只能用函数名调用,不能用对象调用
原型链属于构造函数,不属于对象。
可以通过 对象.成员名 的方式访问原型链上的成员
constructor成员默认是对象的构造函数,当然,可以手动修改第一种方式
var test=new jQuery();
alert(test.constructor);//弹出jquery函数内容第二种方式var test=new jQuery();
alert(test.fn.constructor)//弹出jquery函数内容
jQuery = function( selector, context ) {
return new jQuery.fn.init( selector, context, rootjQuery );
}
jQuery 貌似就是对象吧,还用再new吗
有prototype成员的对象一般就是函数,因为其他对象没有这个默认成员
jQuery既然有prototype成员,多半也就是函数了,当然因为函数也是对象,在上面直接添加成员也是可以成功的
既然是函数,当然可以new了,自己试试吧
--
function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}
---
employee=function (name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}
那上面的两个employee有什么区别呢