摘要: 在解决this问题之后,只需要在每次往自定义属性和事件池当中添加事件的时候进行以下判断就好了,具体代码如下: 阅读全文
posted @ 2017-07-27 15:56 维尼熊320 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1、使用call或apply绑定构造函数 animal.apply(this.arguments) 2、使用prototype属性 Cat.prototype=new Animal(); Cat.prototype.constructor=Cat; var cat1=new Cat("大毛","黄色 阅读全文
posted @ 2017-07-27 15:32 维尼熊320 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 数组去重+快速排序 逻辑是现将原数组与定义的新数组进行循环对比去除重复元素,再将原数组剩余元素推入新数组;最后对新数组里面的元素进行有序排列;此两种算法结合操作实现数组的去重+自行排序的双重解决方案 日期时间函数 var z=new Date();//获取当前时间 var s=z.getTime() 阅读全文
posted @ 2017-07-27 15:20 维尼熊320 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 今天要给大家说的是两个不同页面之间的通信,通过一个拖拽demo来模拟: 首先,写好基础的拖拽代码: 这是将div拖动变化的值存入到本地存储localStorage,用JSON.stringify将其转为字符串形式: localStorage.json=JSON.stringify({left:oDi 阅读全文
posted @ 2017-07-27 14:36 维尼熊320 阅读(272) 评论(0) 推荐(0) 编辑
摘要: //重写alert方法,去掉地址显示 window.alert=function(name){ var iframe=document.createElement("IFRAME"); iframe.style.display="none"; iframe.setAttribute("src",'data:text/plain,'); document.documentElement.... 阅读全文
posted @ 2017-07-27 14:22 维尼熊320 阅读(614) 评论(0) 推荐(0) 编辑