随笔分类 -  javascript

摘要:注意开发HTML页面charset, 如是不是utf-8, 比如是shift_jis, 一般会在webpack里用插件EncodingPlugin把开发的utf-8格式转码成shift_jis格式 那么, 页面会报错如下: 中文: SCRIPT1046: strict 模式下不允许一个属性有多个定义 阅读全文
posted @ 2019-11-27 14:09 roseforyou 阅读(1095) 评论(0) 推荐(0)
摘要://原始从服务器返回的数据 const temp = [ {"categoryId":7, "parent":0, "name":"test0"}, {"categoryId":8, "parent":0, "name":"test1"}, {"categoryId":9, "parent":0, "name":"test2"}, {"catego 阅读全文
posted @ 2019-01-24 10:17 roseforyou 阅读(987) 评论(0) 推荐(0)
摘要:首先需要引入jQuery哈! 1. 后台返回的数据: 2. javaScrip: 3. 生成出的HTML代码: 阅读全文
posted @ 2018-10-30 15:19 roseforyou 阅读(334) 评论(0) 推荐(0)
摘要:demo: http://jsbin.com/lihiwigaso 需求: 一个圆分成分部分, 鼠标滑上不同的区域显示不同的颜色 思路: 先判断这个点是否在圆之内, 再判断是否在所在的三角形之内就可以了 所需要的全部源码: 阅读全文
posted @ 2016-11-28 13:52 roseforyou 阅读(1073) 评论(0) 推荐(0)
摘要:出处: https://github.com/substack/point-in-polygon/blob/master/index.js github: https://github.com/substack/point-in-polygon 判断一个点是否在一个圆这内: 阅读全文
posted @ 2016-11-08 11:18 roseforyou 阅读(8177) 评论(0) 推荐(0)
摘要:前提是你有编辑这个跨域的iframe的权限!! 阅读全文
posted @ 2016-11-07 10:19 roseforyou 阅读(376) 评论(0) 推荐(0)
摘要:https://clipboardjs.com/dist/clipboard.min.js 用clipboard实现复制时, 想让复制的文本换行, 有两种方法: 第一种, HTML实现: 第二种, js实现(以jQuery为例): 阅读全文
posted @ 2016-09-01 15:38 roseforyou 阅读(4924) 评论(0) 推荐(0)
摘要:sublime 正则搜索日语字符 [\x{3041}-\x{3096}\x{30A0}-\x{30FF}\x{3400}-\x{4DB5}\x{4E00}-\x{9FCB}\x{F900}-\x{FA6A}\x{2E80}-\x{2FD5}\x{FF5F}-\x{FF9F}\x{3000}-\x{3 阅读全文
posted @ 2016-08-03 17:13 roseforyou 阅读(573) 评论(0) 推荐(0)
摘要:ios prevent dblclick(tap) page scrollhtml add:("minimal-ui" is very important) eg: 以lightbox_me.js举例说明 阅读全文
posted @ 2016-04-14 09:19 roseforyou 阅读(517) 评论(0) 推荐(0)
摘要:function getMobileOperatingSystem() { var userAgent = navigator.userAgent || navigator.vendor || window.opera; if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /... 阅读全文
posted @ 2016-04-14 09:17 roseforyou 阅读(217) 评论(0) 推荐(0)
摘要:var div = document.createElement('div'); console.log(div.style.transition); //如果支持的话, 会输出 "" //如果不支持的话, 会输出 undefined. //新版本的浏览器不用判断前缀了, 老版本的浏览器还是需要判断前缀 //可参考: http://www.jb51.net/article/56412.htm ... 阅读全文
posted @ 2016-04-13 17:57 roseforyou 阅读(409) 评论(0) 推荐(0)
摘要:在这里谢谢那些无私的人~~这些内容来自这里:我只把js的链接粘到这里了~ 还有其它技术文档, 实在是太多了, 多的看都看不完!!! Google JavaScript 代码风格指南 Google JSON 风格指南 Airbnb JavaScript 规范 JavaScript 标准参考教程(alp 阅读全文
posted @ 2016-04-13 17:55 roseforyou 阅读(366) 评论(0) 推荐(0)
摘要:可以使用iframe-resizer项目地址: http://davidjbradshaw.github.io/iframe-resizer/演示地址: http://davidjbradshaw.com/iframe-resizer/example/ 用法:1.父页面: 引入jQuery.js 和 阅读全文
posted @ 2016-04-13 17:52 roseforyou 阅读(2227) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/57652/how-do-i-get-javascript-to-open-a-popup-window-on-the-current-monitor 居中显示: 阅读全文
posted @ 2016-04-13 17:42 roseforyou 阅读(736) 评论(0) 推荐(0)
摘要:1.location.reload(boolean)默认是false, 相当F5, 从客户端缓存里取当前页, true时从服务端取最新的页面.另外, android不确定是否好用, ios下应该没问题. 2.<meta http-equiv="Cache-control" content="no-c 阅读全文
posted @ 2016-04-13 17:41 roseforyou 阅读(129) 评论(0) 推荐(0)
摘要:原文: http://jaspreetchahal.org/tweet-button-with-a-callback-how-to/ 两种方式:1. 原生的button 2.自定义的button 回调 callback这样写: 注意: 自定义button的href不要这样写, 因为不能触发tweet 阅读全文
posted @ 2016-04-13 17:30 roseforyou 阅读(611) 评论(0) 推荐(0)
摘要:来自网络! 阅读全文
posted @ 2016-04-13 17:26 roseforyou 阅读(188) 评论(0) 推荐(0)
摘要://URL: http://www.example.com/?var1=val1&var2=val2=val3&test=3&test=43&aaa=#2 //window.location.search will return "?var1=val1&var2=val2=val3&test=3&test=43&aaa=" //use the location.search, because ... 阅读全文
posted @ 2016-04-13 17:24 roseforyou 阅读(226) 评论(0) 推荐(0)
摘要:使用JSON.parse需严格遵守JSON规范, 属性都需用双引号引起来, 一定是双引号!! 相反的, JSON对象转字符串: 1 JSON.stringify(value [, replacer] [, space]) 语法讲解参考: http://www.cnblogs.com/damonlan 阅读全文
posted @ 2016-04-13 17:19 roseforyou 阅读(212) 评论(0) 推荐(0)
摘要:javascript里怎么检查一个未定义的变量? in JavaScript null is an object. There's another value for things that don't exist, undefined. The DOM returns null for almos 阅读全文
posted @ 2016-04-13 17:16 roseforyou 阅读(323) 评论(0) 推荐(0)