//给数组添加方法del(),作用是筛选数组内的重复项 Array.prototype.del = function() { var a = {}, c = [], length = this.length; for (var i = 0; i <...
分类:
编程语言 时间:
2014-10-24 18:22:50
阅读次数:
218
/***替换img标签src属性*@paramcontent*@parampath*/functionimgsSrc(content,path){ varimgreg=/<img.*?>/gi; content=content.replace(imgreg,function(imgsrc){ imgsrc=imgsrc.replace(/src=(?:"\s*([^"]*)\s*"|‘\s*([^‘]*)\s*‘|(\S+))/i,"src=\""+path+"$1\""); re..
分类:
微信 时间:
2014-10-24 16:48:26
阅读次数:
363
下面的例子用js举例,到其他语言,比如python也是一样。
var Example = funcion() {
this.table = {};
}
Example.prototype.getTable = function() {
return this.table;
}
var ex1 = new Example();
var tabl...
分类:
Web程序 时间:
2014-10-24 16:38:12
阅读次数:
218
这个例子是官方例子中的一个。这里将其简单的加了些注释。
local TestUIPageViewScene = class("TestUIPageViewScene",function()
return display.newScene("TestUIPageViewScene")
end)
-- ctor 相对于cocos中的init()函数
function TestUIPageV...
分类:
其他好文 时间:
2014-10-24 16:32:26
阅读次数:
290
哎,又是一道笔试题……都怪我太懒,不多思考。之前一直用别人的代码来获取url参数值,别人的代码是用正则表达式来写的,代码如下:1 function getURLParam(name) {2 return decodeURIComponent((new RegExp('[?|&]' + nam...
分类:
Web程序 时间:
2014-10-24 16:28:44
阅读次数:
209
def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return wordsdef sort_words(words): """Sorts t...
分类:
其他好文 时间:
2014-10-24 16:26:57
阅读次数:
166
function canvasSupport(){ return Modernizr.canvas;}function callCanvasApps(){ var canvasOne=document.getElementById("canvasOne"); //if(!canvasSupport(...
分类:
其他好文 时间:
2014-10-24 16:25:01
阅读次数:
164
Lua本身是不能像C++那样直接实现继承,但我们可以用万能的table表来实现。以下我总结了三种方式的类以及继承的实现第一、官方的做法,使用元表实现 原理参照《Programming in lua》 Object.lua Object = {class_id = 0}function Objec.....
分类:
其他好文 时间:
2014-10-24 16:11:13
阅读次数:
215
function iFrameHeight() { var ifm = document.getElementById("mainframe"); var subWeb = document.frames ? document.frames["mainframe"].document :...
分类:
其他好文 时间:
2014-10-24 16:06:49
阅读次数:
206
不管你是使用2D 还是WebGL,任何用过的人都知道很难调试,使用Canvas通常需要长长的难以跟踪的调用列表function draw() { context.clearRect(0, 0, 258, 258); context.fillStyle = "#EEEEEE"; context....
分类:
其他好文 时间:
2014-10-24 16:04:11
阅读次数:
218