码迷,mamicode.com
首页 >  
搜索关键字:function    ( 54714个结果
筛选数组内的重复项
//给数组添加方法del(),作用是筛选数组内的重复项 Array.prototype.del = function() { var a = {}, c = [], length = this.length; for (var i = 0; i <...
分类:编程语言   时间:2014-10-24 18:22:50    阅读次数:218
js替换img标签src属性,并为非微信内核浏览器添加超链接
/***替换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引用带来的问题
下面的例子用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
Quick-Cocos2d-x3.2 UIPageView 简单使用
这个例子是官方例子中的一个。这里将其简单的加了些注释。 local TestUIPageViewScene = class("TestUIPageViewScene",function() return display.newScene("TestUIPageViewScene") end) -- ctor 相对于cocos中的init()函数 function TestUIPageV...
分类:其他好文   时间:2014-10-24 16:32:26    阅读次数:290
js处理url参数
哎,又是一道笔试题……都怪我太懒,不多思考。之前一直用别人的代码来获取url参数值,别人的代码是用正则表达式来写的,代码如下:1 function getURLParam(name) {2 return decodeURIComponent((new RegExp('[?|&]' + nam...
分类:Web程序   时间:2014-10-24 16:28:44    阅读次数:209
Exercise 25: Even More Practice
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
Canvas 生成base64的PNG图片快照,So Amazing!!!
function canvasSupport(){ return Modernizr.canvas;}function callCanvasApps(){ var canvasOne=document.getElementById("canvasOne"); //if(!canvasSupport(...
分类:其他好文   时间:2014-10-24 16:25:01    阅读次数:164
Lua类和类继承实现
Lua本身是不能像C++那样直接实现继承,但我们可以用万能的table表来实现。以下我总结了三种方式的类以及继承的实现第一、官方的做法,使用元表实现 原理参照《Programming in lua》 Object.lua Object = {class_id = 0}function Objec.....
分类:其他好文   时间:2014-10-24 16:11:13    阅读次数:215
iframe自适应高度
function iFrameHeight() { var ifm = document.getElementById("mainframe"); var subWeb = document.frames ? document.frames["mainframe"].document :...
分类:其他好文   时间:2014-10-24 16:06:49    阅读次数:206
使用chrome开发工具调试Canvas(转)
不管你是使用2D 还是WebGL,任何用过的人都知道很难调试,使用Canvas通常需要长长的难以跟踪的调用列表function draw() { context.clearRect(0, 0, 258, 258); context.fillStyle = "#EEEEEE"; context....
分类:其他好文   时间:2014-10-24 16:04:11    阅读次数:218
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!