码迷,mamicode.com
首页 >  
搜索关键字:cost function    ( 56282个结果
this的指向
//this 指的是调用 当前方法 (函数) 的那个对象function fn1(){ this; }//fn1(); this => window//obj.onclick=fn1; this=>obj//obj.onc...
分类:其他好文   时间:2014-05-26 20:16:04    阅读次数:245
LeetCode: Two Sum 题解
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:其他好文   时间:2014-05-26 19:50:39    阅读次数:314
CoffeeScript的类继承的工具函数extends
__hasProp = {}.hasOwnProperty, __extends = function(child, parent) { // 派生类时,类方法会生成多个副本。 for (var key in parent) { i...
分类:其他好文   时间:2014-05-26 19:36:25    阅读次数:278
javascript codes
谷歌、火狐全屏:1 addEventListener("click", function() {2 var3 el = document.documentElement4 , rfs = el.webkitRequestFullScreen5 ...
分类:编程语言   时间:2014-05-26 18:42:13    阅读次数:211
注册验证
var userid = $("username");var usersp = $("usersp");var reg = /^[A-Za-z0-9_\-\u4e00-\u9fa5]+$/;function $(id){ return document.getElementById(id);} f....
分类:其他好文   时间:2014-05-25 22:43:36    阅读次数:299
Jquery绑定事件(bind和live的区别)
Jquery中绑定事件有三种方法:以click事件为例 (1)target.click(function(){}); (2)target.bind("click",function(){}); (3)target.live("click",function(){});第一种方法很好理解,其实就和普通...
分类:Web程序   时间:2014-05-25 21:59:52    阅读次数:242
js堆栈溢出错误
function prompt() { var answer = prompt("What is your name","") if (answer) { alert("Hello, " + answer + "!"); } } 提示堆栈溢出。我就纳闷了。 反复测试之后,发现...
分类:Web程序   时间:2014-05-25 21:58:48    阅读次数:268
PHP中输出缓冲
<?php /*--------------------编写自己的缓存类---------------*/ class my_cache{ //定义有关变量 private $cache_time;//缓存有效时间 private $cache_file;//缓存文件保存路径 //初始化类,默认是index.html时间是1 function __construc...
分类:Web程序   时间:2014-05-25 21:54:23    阅读次数:328
【Espruino】NO.04 让灯自由闪动
上一节内容讲解了如何让LED小灯亮与灭,如果要实现闪烁的话,需要瞧很多代码,而且无法控制亮灭的时间间隔。本节,我们将采用两种方法,分别引入三个函数来分别实现闪烁功能,让控制更简单更准确。 第一种方法:通过延时函数来搞定 setTimeout()函数描述:在经过timeout个毫秒后执行function功能,返回一个ID,可以被clearTimeout()调用 function setTimeout(function,timeout) setInterval()描述:定期执行function功能,周期为ti...
分类:其他好文   时间:2014-05-25 21:32:29    阅读次数:297
php类
host = $host; $this->user = $user; $this->pwd = $pwd; $this->db = $db; $this->charset = $charset; $this->conn = get_conn(); } public function ge...
分类:Web程序   时间:2014-05-25 19:49:42    阅读次数:317
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!