摘要: [javascript]function a(){ this.firstAttr = 'i an the original this.first'; this.firstMethod = function(){ //this is the first original firstMethod() };}a.prototype = { constructor:a... 阅读全文
posted @ 2010-08-23 15:55 7hihi 阅读(130) 评论(0) 推荐(0) 编辑
摘要: [javascript]YUI.add("yui-throttle", function(Y) { /* Based on work by Simon Willison: http://gist.github.com/292562 */ var throttle = function(fn, ms) { ms = (ms) ? ms : (Y.config.throttl... 阅读全文
posted @ 2010-08-23 15:52 7hihi 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 我们用firebug调试js程序时,dir出来的函数体会出现几种颜色1:black 代表函数变量[包括var定义的字符串变量,this. 定义的变量内部变量,等等非函数变量],2:green 代表函数[prototype中的函数,静态函数,所有函数]3:red prototype 被修改时出现,一般情况下就这前种色对我们调试比较有用,但时不时的你会看到红色,其实本不会出现红色,但一个函数的prot... 阅读全文
posted @ 2010-08-23 15:49 7hihi 阅读(99) 评论(0) 推荐(0) 编辑
摘要: YUI 中有两个 Env[enviroment]1:Y.Env 这里的Env通过 _attach 对象记录有那些个模块被挂载了.通过_used对象记录那些个模块被使用过了.2:Y.constructor.Env 通过mods对象存放那些通过prototype.add添加的模块.里面同样也有一个 _attach 对象和一个_used对象,只不过它是执行prototype.add添加模块时有模块被添加... 阅读全文
posted @ 2010-08-23 15:47 7hihi 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 1:继承:1.1->类继承: Y.extend ,关键点:object.superclass.constructor.apply(this, arguments);继承的子类和父类之间有上下级关系,是一种严格的继承。1.2->原型继承:Y.Object(obj):注意点:子类中的方法和同名属性有优先权。2:重用:只是简单的函数属性的转移拷贝2.1->对象扩充:Y.augment(newOjb,ol... 阅读全文
posted @ 2010-08-17 12:38 7hihi 阅读(126) 评论(0) 推荐(0) 编辑
摘要: [html]test me[/html][javascript]var jQuery = $ = function(selector, context) { // jQuery 对象就是 init 函数的一个实例 return new jQuery.fn.init(selector, context);}jQuery.fn = jQuery.prototype = { i... 阅读全文
posted @ 2010-08-17 10:27 7hihi 阅读(151) 评论(0) 推荐(0) 编辑
摘要: [javascript]// Define a local copy of jQueryvar jQuery = $ = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.in... 阅读全文
posted @ 2010-08-17 10:20 7hihi 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 先不废话,直接代码。[html]Fire publisher:testEventStop Propagation (testEvent won't bubble to the BubbleTarget.)Prevent Default (testEvent's defaultFn won't fire.) Custom Event log messages will appear here.[/h... 阅读全文
posted @ 2010-08-17 09:33 7hihi 阅读(227) 评论(0) 推荐(0) 编辑
摘要: [javascript]function test(message){ this.msg = message; this.shout = function(){ alert(this.msg); } this.waitShout = function(){ //要求:在此处添加代码让shout方法5秒钟后执行,提示:使用setTimeout //方法1: //setTimeout(func... 阅读全文
posted @ 2010-08-16 20:40 7hihi 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 今天给表哥做个产品展示页面,由于早听说wordpress很强大,所以就慕名用了这套程序来搭建这个企业网站,从来没用过它,一步步黑灯瞎火的做下去,浪费了我不少时间,这不,被这个get_categories函数耍了,要实现把指定分类显示出来,每个分类下面显示前10条产品,怎么搞不行,最后get_categories给解决了。小记一下。[php]foreach((get_categories()) as... 阅读全文
posted @ 2010-08-16 17:02 7hihi 阅读(128) 评论(0) 推荐(0) 编辑