随笔分类 -  javascript

摘要:GitHub地址 目标网站:妹子图(点进去别忘了回来~~)项目功能:批量下载该网站的相册姊妹项目:批量爬取并下载头条视频 启动项目 命令: 配置文件: 技术点 Axios: 发起 get 请求,获取页面和图片 stream Cheerio: 覆盖了 jQuery dom 部分核心 API,可操作获取 阅读全文
posted @ 2018-09-17 00:28 提佰萬 阅读(2855) 评论(0) 推荐(0)
摘要:How to detect Safari, Chrome, IE, Firefox and Opera browser? Demo: https://jsfiddle.net/311aLtkz/ 阅读全文
posted @ 2017-07-18 21:19 提佰萬 阅读(354) 评论(0) 推荐(0)
摘要:Object.keys() 返回一个由给定对象的自身可枚举属性组成的数组。 阅读全文
posted @ 2017-03-22 10:56 提佰萬 阅读(213) 评论(0) 推荐(0)
摘要:Array.prototype.reduce() 语法:arr.reduce(callback,[initialValue]) reduce() 方法对累加器和数组的每个值 (从左到右)应用一个函数,以将其减少为单个值。 Array.prototype.find() arr.find(callbac 阅读全文
posted @ 2017-03-20 18:09 提佰萬 阅读(157) 评论(0) 推荐(0)
摘要:for - 循环代码块一定的次数for/in - 遍历数组或者对象的属性(对数组或者对象的属性进行循环操作) 注意:for/in 循环会访问该对象的原型,应该用在非数组对象的遍历上,不建议使用该方法遍历数组。 示例: 结果: 阅读全文
posted @ 2017-02-22 10:24 提佰萬 阅读(4336) 评论(0) 推荐(0)
摘要:Example 1 2 3 4 5 6 Demo 7 8 9 10 25 26 阅读全文
posted @ 2016-01-18 09:43 提佰萬 阅读(307) 评论(0) 推荐(0)
摘要:event.stopPropagation()Description: Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.... 阅读全文
posted @ 2016-01-11 23:16 提佰萬 阅读(379) 评论(0) 推荐(0)
摘要:Differenceconsole.log prints the element in an HTML-like treeconsole.dir prints the element in a JSON-like treeExampleSpecifically, console.log gives ... 阅读全文
posted @ 2016-01-02 23:23 提佰萬 阅读(2904) 评论(0) 推荐(0)
摘要:onmousewheel (FireFox不支持此事件)1 // IE/Opera/Chrome/Safari2 document.body.onmousewheel = function(event) {3 event = event || window.event;4 conso... 阅读全文
posted @ 2016-01-02 23:08 提佰萬 阅读(765) 评论(0) 推荐(0)
摘要:Steps:1.保存到数据库之前把textarea中的换行字符转换为。var dbStr = textareaStr.replace(/\n|\r\n/g,"");2.读取数据时把 替换成textarea的换行符\n。var reg = new RegExp("","g"); //创建正则RegE... 阅读全文
posted @ 2015-12-30 10:27 提佰萬 阅读(1423) 评论(0) 推荐(0)
摘要:URI 统一资源标识符 Uniform Resource IdentifierURL 统一资源定位符 Uniform Resource LocatorURN 统一资源名称 Uniform Resource NameWikipedia:URL: URL是URI的一种,不仅标识了互联网资... 阅读全文
posted @ 2015-12-28 21:11 提佰萬 阅读(336) 评论(0) 推荐(0)
摘要:URI: Uniform Resource IdentifierencodeURI() And decodeURI()The encodeURI() function is used to encode a URI.The encodeURI()function encodes special ch... 阅读全文
posted @ 2015-12-28 14:14 提佰萬 阅读(339) 评论(0) 推荐(0)
摘要:JavaScript trim()Syntaxstring.trim()The trim() method removes whitespace from both sides of a string.The trim() method does not change the original st... 阅读全文
posted @ 2015-12-25 10:00 提佰萬 阅读(291) 评论(0) 推荐(0)
摘要:window.setInterval() 周期性地调用一个函数(function)或者执行一段代码。1 var intervalID = window.setInterval(func, delay[, param1, param2, ...]);2 var intervalID = window.... 阅读全文
posted @ 2015-12-20 17:49 提佰萬 阅读(489) 评论(0) 推荐(0)
摘要:相关:jquery-cookiecookie 是存储于访问者的计算机中的变量,常用来存储用户名字,密码,日期.示例:1 document.cookie="username=John Doe";2 document.cookie="username=John Doe; expires=Thu, 18 ... 阅读全文
posted @ 2015-12-18 18:15 提佰萬 阅读(215) 评论(0) 推荐(0)
摘要:window.location 对象在编写时可不使用 window 这个前缀。URL : 统一资源定位符 (Uniform Resource Locator)说明:完整的URL示例:scheme://host:port/path?query#fragmentscheme:通信协议常用的http,ft... 阅读全文
posted @ 2015-12-18 10:01 提佰萬 阅读(483) 评论(0) 推荐(0)
摘要:repalce() 只能替换字符串中的匹配到的第一个字符或者字符串正则表达式 替换多个字符或者字符串注意:一些数字型的字符串使用replace() 时要确保是字符串,而不是数字。转换方法: str = num.toString(); str = num + "";定义正则表达式:var reg... 阅读全文
posted @ 2015-12-15 10:45 提佰萬 阅读(555) 评论(0) 推荐(0)
摘要:javascript:var textarea = document.getElementById('textarea_id');textarea.scrollTop = textarea.scrollHeight;jQuery:$(document).ready(function(){ $(... 阅读全文
posted @ 2015-12-15 10:24 提佰萬 阅读(1094) 评论(0) 推荐(0)
摘要:金额格式化example: 1 2 3 4 5 6 7 Hello 8 27 28 result: 阅读全文
posted @ 2015-12-11 00:21 提佰萬 阅读(385) 评论(0) 推荐(0)