- 博客(15)
- 收藏
- 关注
转载 获取事件对象
方法1: html代码<div id="box"></div> javascript代码 var oBox = document.getElementById("box"); oBox.on...
2018-02-13 10:26:00
191
转载 阻止事件冒泡的兼容性写法
//阻止冒泡事件的兼容性处理 function stopBubble(e) { if(e && e.stopPropagation) { //非IE e.stopPropagation(); } else { //IE wind...
2018-02-13 10:21:00
217
转载 获取简单的demo元素函数
//获取dom方法 function get_dom(obj){ if(!obj || Object.prototype.toString.call(obj) != "[object String]"); //获取参数的首位 ...
2017-10-16 16:34:00
329
转载 js判断浏览器的类型
/** * 是否IE * * @return Boolean */ isIE : function(){ return !!(document.all || window.ActiveXObject); }, ...
2017-07-21 08:26:00
132
转载 javascript中对cookie的封装
Cookie = { /** * 设置Cookie * * @param name * String Cookie名 * @param value ...
2017-07-19 11:43:00
111
转载 获取定位元素相对于浏览器窗口的绝对位置
//获取定位元素相对于浏览器窗口的绝对位置 function _getAbsolutePosition(obj) { //如果函数没有传入值的话返回对象为空的 if(!obj)return null; var w = ...
2017-07-19 09:55:00
3530
转载 获取资源路中的key所对应的值
function getUrlPra(parme){ if(!parme)return; if(!window.location.search)return; var h = window.loc...
2017-07-11 16:19:00
227
转载 js获取函数宽高的兼容写法
//js获取窗口宽高的兼容个主流浏览器的写法 var pageWidth = window.innerWidth, pageHeight = window.innerHeight; if (typeof pageWidth != "number"){ ...
2017-04-20 17:20:00
217
转载 jquery中关于offset函数和position函数的区别
offset函数是获取元素向对文档的位置 函数返回的对象中包含位置 所以我认为其中封装的原理为 function _getAbsolutePosition(obj) { if(!obj)return null; var w = obj....
2017-04-20 14:30:00
227
转载 浏览器退出和进入全屏的方法
//浏览器退出全屏的方法 function exitFullScreen() { var el = document; var cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.exitFullS...
2017-04-06 17:26:00
202
转载 dom元素实现动画的思想
//dom元素的html部分 div#box{width:100px; height:10px; background:red;} js部分 var obox = document.querySelector("#box"); var timer = null; ...
2017-03-31 15:40:00
138
转载 js中时间监听的兼容性写法
function elmAddEventListener(elm,evType,fn,useCapture){ useCapture = useCapture || false; if(elm.addEventL...
2017-03-31 15:30:00
162
转载 js用ajax请求天气接口
function findWeather() { var cityUrl = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js'; $.getScript(cityUrl...
2017-03-31 15:26:00
753
转载 js实现调用调用设备的日期时间
/*时间*/ function showLocale(objD) { var str, colorhead, colorfoot; var yy = objD.getYear(); if (yy < ...
2017-03-31 15:22:00
278
转载 前端js实现新闻列表数据动态滚动效果的函数
window.onload = function() { setTimeout("startmarquee(34, 50, 0, 'data')", 1000); }; function startmarquee(lh,sp...
2017-03-31 15:18:00
915
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅