随笔分类 -  js

about js more
该文被密码保护。
posted @ 2019-04-25 14:20 justSmile2 阅读(4) 评论(0) 推荐(0)
摘要:画按钮 您的浏览器不支持Canvas,请升级浏览器! 阅读全文
posted @ 2019-04-25 11:29 justSmile2 阅读(377) 评论(0) 推荐(0)
摘要:<meta charset="utf-8"> <canvas width="1000" height="1000" id="clockCanvas" style="border:1px solid red;"> 您的浏览器版本太低,不支持显示时钟的canvas标签 </canvas> <script 阅读全文
posted @ 2019-04-25 11:26 justSmile2 阅读(216) 评论(0) 推荐(0)
摘要:水波背景 阅读全文
posted @ 2019-04-25 11:24 justSmile2 阅读(250) 评论(0) 推荐(0)
摘要:<style type="text/css"> span{ display: block; float: left; width: 50px; height: 50px; border: 1px solid red; background-color: #000; } div{ width: 520 阅读全文
posted @ 2019-04-25 11:18 justSmile2 阅读(147) 评论(0) 推荐(0)
摘要:细节1 1.Chrome中文界面下会将小于12px的字体默认显示为12px,解决方法:在CSS中加入-webkit-text-size-adjust:none; 2.link可以加载除CSS以外的其他文档,@import只能加载CSS 3.IE下,可以使用普通方法获取自定义属性,也可以使用getAt 阅读全文
posted @ 2019-04-25 10:56 justSmile2 阅读(124) 评论(0) 推荐(0)
摘要:js 兼容问题 1. document.form.item 问题问题:代码中存在 document.formName.item("itemName") 这样的语句,不能在FF下运行解决方法:改用 document.formName.elements["elementName"] 2. 集合类对象问题 阅读全文
posted @ 2019-04-25 10:37 justSmile2 阅读(389) 评论(0) 推荐(0)
摘要:1.常用 api 1.旋转中心点设置 ctx.rotate(20*Math.PI/180); 以画布(0,0) ctx.rotate(20*Math.PI/180,50,20); 以画布(50,20) 2.相对定位原点 translate() 方法重新映射画布上的 (0,0) 位置 3.画圆 con 阅读全文
posted @ 2019-04-25 10:20 justSmile2 阅读(145) 评论(0) 推荐(0)
摘要:var myTest = function () { var value = 0; return { add: function () { value++; }, // value:value, value: function () { return value; } } }(); console. 阅读全文
posted @ 2019-04-24 19:08 justSmile2 阅读(168) 评论(0) 推荐(0)
摘要:js单线程阻塞实例setTimeout(function () { while (true) { } }, 1000);setTimeout(function () { alert('end 2'); }, 2000);setTimeout(function () { alert('end 1'); 阅读全文
posted @ 2019-04-24 18:47 justSmile2 阅读(1111) 评论(0) 推荐(0)
摘要:setTimeout 与 setInterval 实现回调本质上区别:setTimeout(function(){ /* Some long block of code ... */ setTimout(arguments.callee,10);},10);setInterval(function( 阅读全文
posted @ 2019-04-24 18:45 justSmile2 阅读(106) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2019-04-24 18:38 justSmile2 阅读(5) 评论(0) 推荐(0)
摘要:1. this 指向 结合箭头函数的this分析 函数执行方式 this指向1.直接圆括号 window2.对象调用 对象3.事件触发 触发对象4.定时器运行 window (常常定义变量存储this以达到this指向特定对象)5.作为数组对象的某个元素 该数组对象 调用一个函数将暂停当前函数的执行 阅读全文
posted @ 2019-04-24 18:28 justSmile2 阅读(509) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2019-04-24 16:51 justSmile2 阅读(6) 评论(0) 推荐(0)
摘要:indexOf 返回数值类型 ( 索引、-1 ) includes 返回布尔类型 ( true 、false ),且能区分出 NaN undefined ( 如新建空数组 ) 测试代码 var arr=[1,2,3,NaN] arr.indexOf(3) // 2 arr.indexOf(NaN) 阅读全文
posted @ 2019-04-24 15:24 justSmile2 阅读(205) 评论(0) 推荐(0)
摘要:Array.from的设计初衷是快速便捷的基于其他对象创建新数组,准确来说就是从一个类似数组的可迭代对象( Object、Array、String,Set,Map,arguments等 )创建一个新的数组实例,说人话就是,只要一个对象有迭代器,Array.from就能把它变成一个数组 Array.f 阅读全文
posted @ 2019-04-24 14:15 justSmile2 阅读(1000) 评论(0) 推荐(0)
摘要:相关知识点: 构造函数、原型对象、实例对象 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale= 阅读全文
posted @ 2019-04-24 13:54 justSmile2 阅读(214) 评论(0) 推荐(0)
摘要:1.demo <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <title>demo</title> <link rel="stylesheet" href="http://cdn.dowebok.com/98/cs 阅读全文
posted @ 2019-04-19 19:21 justSmile2 阅读(134) 评论(0) 推荐(0)
摘要:1. es5 类写法 function People(name) { this.name = name; } People.prototype.getName = function () { return this.name; }; var people = new People("strick") 阅读全文
posted @ 2019-04-15 17:57 justSmile2 阅读(102) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2019-04-15 11:22 justSmile2 阅读(16) 评论(0) 推荐(0)