function a() { var n = 0; for(var i=1;i<10000000;i++) { n=i+n; } document.getElementById('a1').value=n; } function b() { document.getElementById("a2").value=22222; } a(); b(); 看上面的这两个函数,在执行的结果写入两个inpu
function makeid() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for( var i=0; i < 5; i++ ) text += possible.charAt(Math.floor(Math.random() * possib
// 更新: // 05.27: 1、保证回调执行顺序:error > ready > load;2、回调函数this指向img本身 // 04-02: 1、增加图片完全加载后的回调 2、提高性能 /** * 图片头数据加载就绪事件 - 更快获取图片尺寸 * @version 2011.05.27 * @author TangBin(PS:我不是作者,我只是代码的搬运工) * @see http:
问题 M是一个对象的集合,没个对象拥有唯一的字符串类型的Id N是Id的集合。 从M中过滤掉Id不在N中的对象。 假如M有50w个数据,N中可能是0~50w任意的数据。 方案1 使用数组保存Id的集合。 这样就有两种方式遍历 1.1 N = [id, ...]; for(var m in M) for(var n in N){ ..... } 1.2 for(var m in M) if(N.in
function BaseClass1(){ this.age=10; this.sex='male'; } BaseClass1.prototype.run = function(){ console.log("run"); } function BaseClass2(){ this.prop1='prop1'; this.prop2='prop2'; } BaseClass2.prototyp
html部分: <div class="main"> <div id="xiaotu" class="xiaotu"> <img src="http://zhangyan520.com/1.jpg" alt="" /> <div id="yidong" class="yidong"></div> </div> <div id="datu" class="
var LunarDate = { madd: new Array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334), HsString: '甲乙丙丁戊己庚辛壬癸', EbString: '子丑寅卯辰巳午未申酉戌亥', NumString: "一二三四五六七八九十", MonString: "正二三四五六七八九十冬腊", Calendar
String.prototype.trim = function(){ return this.replace(/(^[\\s]*)|([\\s]*$)/g, ""); } String.prototype.lTrim = function(){ return this.replace(/(^[\\s]*)/g, ""); } String.prototype.rTrim = function()
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>TT</title> <script src="jquery.js"></script> </head> <body> <p style="line-height: 50%;"><span></span></p> <input type="button" value="轻轻" o
// Read a page's GET URL variables and return them as an associative array. function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).
solid #db6e3c; }