随笔分类 - js
摘要:描述: 使用JavaScript完成指定的日期的倒计时,例如距离活动还有多少时间结束 算法: 1.使用时间对象的getTime()方法获取所有的毫秒数 2.将指定时间的毫秒数和当前时间的毫秒数相减得到中间相差的毫秒数 3.每一天的毫秒数为:1000*60*60*24 就是1000毫秒*60秒*60分
阅读全文
摘要:类数组 <script type="text/javascript"> var obj={ "0":'a', '1':'b', 'length':2, 'splice':Array.prototype.splice, 'push':Array.prototype.push } Array.proto
阅读全文
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv
阅读全文
摘要:浏览器内核 1 五大主流浏览器 2 1.IE 内核trident 3 2.Chrome webkit/blink 4 3.Safari webkit 5 4.firefox Gecko 6 5.Opera presto js封装方法 //查看滚动条滚动的距离 function getScrollOf
阅读全文
摘要:页面自动滚动 <div style="width: 50px;height:50px;border-radius: 50%;background: red;position: fixed;bottom: 300px;right: 300px; text-align: center;line-heig
阅读全文
摘要:es5严格模式 1 <script type="text/javascript"> 2 "use strict"; 3 function test(){ 4 console.log(arguments.callee); 5 } 6 test(); 7 </script> try...catch <s
阅读全文
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv
阅读全文
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv
阅读全文
摘要:继承 <script type="text/javascript"> Father.prototype.name="wangxinngyu"; function inherit(Target,Origin){ function F(){} F.prototype=Origin.prototype;
阅读全文
摘要:1 XmlHttp是什么? 2 最通用的定义为:XmlHttp是一套可以在Javascript、VbScript、Jscript等脚本语言中通过http协议传送或从接收XML及其他数据的一套API。XmlHttp最大的用处是可以更新网页的部分内容而不需要刷新整个页面。 3 来自MSDN的解释:Xml
阅读全文
摘要://点击菜单时箭头旋转 let treeView = document.getElementsByClassName("treeview");//let解决闭包问题 let last=document; for (let i = 0; i <treeView.length ; i++) { tree
阅读全文