文章分类 - JavaScript
摘要:From: http://www.webdeveasy.com/backbone-singleton/Using Backbone.js, sometimes we need a model that will act like a singleton. Other times we want to reuse the type of that singleton. This article will present two different ways of creating a singleton using Backbone.js and require.js. While the fi
阅读全文
摘要:转...原文不知道是出自哪里,知道者请知会一下。 要判断jquery的选择器选择的东东是否为空的时候,也就是没有符合选择器的对象被选择到的时候怎么办呢,尝试了判断对象为空,但是不是的,alert出来时[object][object]。没辙了,搜了一下,看到一段比较好的解释。 之后我就改成$("#id").length==0结果返回true这样就可以通过这样判断是否存在符合选择器条件的内容存在了。 讨论 $('#id') 和 $('#id')[0] 的区别。用alert打印出来的却别是[Object Object] 和 [Object]于是我认
阅读全文
摘要:1. 对象冒充function ClassA(sColor) { this.color = sColor; this.sayColor = function () { console.log(this.color); } } function ClassB(sColor, sName) { this.newMethod = ClassA; this.newMethod(sColor); delete this.newMethod; thi...
阅读全文
浙公网安备 33010602011771号