随笔分类 -  js/jq

1 2 3 4 5 ··· 10 下一页
摘要:zepto This is a headingThis is a paragraph.This is another paragraph.切换段落的 "main" 类 zepto This is a heading Apple IBM Mi... 阅读全文
posted @ 2014-12-16 18:05 小猩猩君 阅读(1755) 评论(0) 推荐(0) 编辑
摘要:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reducevar ss = [0, 1, 2, 3, 4].reduce(function (previousValue, ... 阅读全文
posted @ 2014-12-16 17:30 小猩猩君 阅读(280) 评论(0) 推荐(0) 编辑
摘要:JavaScript中所有变量及函数名会自动提升http://www.cnblogs.com/betarabbit/archive/2012/01/28/2330446.html 阅读全文
posted @ 2014-11-14 14:04 小猩猩君 阅读(177) 评论(0) 推荐(0) 编辑
摘要:var a = "http://www.xx.com?id=111&-deb";var b = "http://www.xx.com?-deb&id=111";var d = "http://www.xx.com?-deb&id=111&cc=2";var c = "http://www.xx.co... 阅读全文
posted @ 2014-11-07 09:38 小猩猩君 阅读(220) 评论(0) 推荐(0) 编辑
摘要:123456789,4567831匹配前面的4567还有后面的83var r = /\d{3}4567\d{2}[,]\d{4}83\d/; var e = "123456789,4567831"; console.log(r.test(e)); 阅读全文
posted @ 2014-11-05 16:54 小猩猩君 阅读(242) 评论(0) 推荐(0) 编辑
摘要:最近想把项目里添加grunt,说白了就是前端自动化管理,具体配置如下:用到以下几个部件:grunt-contrib-cssmingrunt-contrib-uglifygrunt-contrib-jshintgrunt-contrib-imagemingrunt-contrib-concat这几个应... 阅读全文
posted @ 2014-10-29 17:02 小猩猩君 阅读(526) 评论(0) 推荐(0) 编辑
摘要:bind(type,[data],fn) 为每个匹配元素的特定事件绑定事件处理函数$("a").bind("click",function(){alert("ok");});live(type,[data],fn) 给所有匹配的元素附加一个事件处理函数,即使这个元素是以后再添加进来的$("a").l... 阅读全文
posted @ 2014-10-27 17:00 小猩猩君 阅读(218) 评论(0) 推荐(0) 编辑
摘要:1 function installGrunt(data) {2 for (var val in data) {3 console.log(data[val]);4 }5 }6 7 installGrunt(['a', 'b', 'c']); 阅读全文
posted @ 2014-02-24 15:48 小猩猩君 阅读(184) 评论(0) 推荐(0) 编辑
摘要:1 function Car(model, year, miles) { 2 this.model = model; 3 this.year = year; 4 this.miles = miles; 5 } 6 7 Car.prototype.toString = function() { 8 return this.model + " has done " + this.miles + " miles"; 9 };10 11 var civic = new Car("Honda Civic", 2009, 20000);12 va 阅读全文
posted @ 2014-02-08 16:10 小猩猩君 阅读(239) 评论(0) 推荐(0) 编辑
摘要:1 var fs = require('fs'); 2 var txt = "以上程序使用fs.readFileSync从源路径读取文件内容,并使用fs.writeFileSync将文件内容写入目标路径。"; 3 4 //写入文件 5 fs.writeFile('message.txt', txt, function (err) { 6 if (err) throw err; 7 console.log('It\'s saved!'); //文件被保存 8 }); 9 10 //读取文件11 fs.readFile(& 阅读全文
posted @ 2014-01-26 09:57 小猩猩君 阅读(14011) 评论(0) 推荐(0) 编辑
摘要:1 var O_dialog = $("#dialog-modal"); 2 O_dialog.dialog({ 3 closeOnEscape: false, 4 width: 250, 5 height: 80, 6 resizable: false, 7 draggable: false, 8 modal: true, 9 title: "正在加载,请稍候...",10 //隐藏默... 阅读全文
posted @ 2013-12-20 09:09 小猩猩君 阅读(22562) 评论(0) 推荐(0) 编辑
摘要:首先页面加载时候显示遮罩层jQuery(function() { show_dialog(); //tianxie();});定义一个全局数组,用于存放问题idvar qar = [];循环问题id,并赋值到qar数组中for (quid_index = 0; quid_index < results.totalProperty; quid_index++) { questions[quid_index] = []; questions[quid_index][0] = results.content[quid_index].quid; //问题编号 questi... 阅读全文
posted @ 2013-12-16 16:30 小猩猩君 阅读(3601) 评论(0) 推荐(0) 编辑
摘要:html:1 javascript: 1 //管理端短信 2 var textarea_text = "此短信功能仅限于工作联络之用,切勿发送保密或敏感信息!支持移动、联通、小灵通,小灵通号码前需加区号;多个号码间用空格分隔可支持群发。"; 3 var dxtd_text = $(".dxtd_text"); 4 dxtd_text.val(textarea_text); 5 dxtd_text.on("focus", function () { 6 if (dxtd_text.val() == textarea_text) { 7 阅读全文
posted @ 2013-12-06 16:45 小猩猩君 阅读(759) 评论(0) 推荐(0) 编辑
摘要:需求如下:第一个input添加字符到第二个input,第二个input需要累加。html: 1 2 *企业填报数据包含海关代码有: 3 4 5 6 7 8 9 10 11 12 js: 1 //企业填报数据包含海关代码有 赋值 2 $("#hgdm_plus").on("click", function () { 3 v... 阅读全文
posted @ 2013-11-28 16:22 小猩猩君 阅读(1478) 评论(0) 推荐(0) 编辑
摘要:http://learn.jquery.com/using-jquery-core/iterating/The following is a list of methods that require.each():.attr()(getter).css()(getter).data()(getter).height()(getter).html()(getter).innerHeight().innerWidth().offset()(getter).outerHeight().outerWidth().position().prop()(getter).scrollLeft()(getter 阅读全文
posted @ 2013-11-05 11:21 小猩猩君 阅读(215) 评论(0) 推荐(0) 编辑
摘要:1 switch (window.location.hostname) { 2 case "www.zcom.gov.cn" ://确定域名为 www.zcom.gov.cn 3 //window.location.pathname="/"//跳转到 / 目录 4 break; 5 case "cisf.zcom.gov.cn" ://确定域名为 cisf.zcom.gov.cn 6 window.location.pathname = "/swz2013/"//跳转到 /swz2013/ 目录 7 break;. 阅读全文
posted @ 2013-07-17 08:49 小猩猩君 阅读(1916) 评论(0) 推荐(0) 编辑
摘要:1 $("form").submit(function () {2 console.log("提交了");3 $("input:submit").attr("disabled", "true");4 setTimeout(function () {5 $("input:submit").removeAttr("disabled");6 }, 3000);7 });网上看到老外写的 1 // jQuery plugin to prevent double.. 阅读全文
posted @ 2013-07-08 16:26 小猩猩君 阅读(328) 评论(0) 推荐(0) 编辑
摘要:1 function Klass() { 2 this.id = new Date().getTime(); 3 this.name = ''; 4 } 5 6 Klass.prototype.get = function() { 7 return this.id; 8 }; 9 10 Klass.prototype.set = function(name) {11 this.name = name;12 };13 14 var test1 = new Klass();15 var test2 = new Klass();16 test1.set('tttt... 阅读全文
posted @ 2013-07-08 08:58 小猩猩君 阅读(124) 评论(0) 推荐(0) 编辑
摘要:1 // 最佳做法:如果可用,使用本地XHR 2 if (window.XMLHttpRequest) { 3 // 如果是IE7+, Gecko, WebKit:使用本地对象 4 var xmlHttp = new XMLHttpRequest(); 5 } else if (window.ActiveXObject) { 6 // ...如果不是,尝试ActiveX控件 7 var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 8 } else { 9 // 没有XMLHTTPRequest机制... 阅读全文
posted @ 2013-07-07 22:33 小猩猩君 阅读(269) 评论(0) 推荐(0) 编辑
摘要:1 var arr1 = function() { 2 console.log("arr1"); 3 }; 4 var arr2 = function() { 5 console.log("arr2"); 6 }; 7 var arr3 = function() { 8 console.log("arr3"); 9 };10 11 window.onload = function() {12 setTimeout(function() {13 var arr = [arr1(), arr2(), arr3()];14 }, 1000) 阅读全文
posted @ 2013-06-13 16:39 小猩猩君 阅读(230) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 10 下一页