06 2015 档案
关于“回到顶部”的一些笔记
摘要:回到顶部 阅读全文
posted @ 2015-06-25 22:58 Alone_Learner 阅读(132) 评论(0) 推荐(0)
js获取网页屏幕可见区域高度
摘要:document.body.clientWidth ==> BODY对象宽度document.body.clientHeight ==> BODY对象高度document.documentElement.clientWidth ==> 可见区域宽度document.documentElement.c... 阅读全文
posted @ 2015-06-25 22:15 Alone_Learner 阅读(198) 评论(0) 推荐(0)
document的createDocumentFragment()方法
摘要:在更新少量节点的时候可以直接向document.body节点中添加,但是当要向document中添加大量数据是,如果直接添加这些新节点,这个过程非常缓慢,因为每添加一个节点都会调用父节点的appendChild()方法,为了解决这个问题,可以创建一个文档碎片,把所有的新节点附加其上,然后把文档碎片一... 阅读全文
posted @ 2015-06-23 20:12 Alone_Learner 阅读(311) 评论(0) 推荐(0)
自定义数组函数
摘要:// 自定义数组函数Array.prototype.maxima。//Array.prototype为必须的,maxima为数组名。//调用时arr.maxima()这样调用window.onload = function() { Array.prototype.sum = function(){ ... 阅读全文
posted @ 2015-06-20 23:09 Alone_Learner 阅读(462) 评论(0) 推荐(0)
电子时钟,骷髅时钟
摘要: 阅读全文
posted @ 2015-06-20 22:56 Alone_Learner 阅读(150) 评论(0) 推荐(0)
添加,删除事件的函数
摘要:var EventUtil = {// oElement触发元素。sEvent绑定事件click?或者其他。fnHandler,绑定的函数。 addHandler: function (oElement, sEvent, fnHandler) { oElement.addEventListener... 阅读全文
posted @ 2015-06-20 22:55 Alone_Learner 阅读(270) 评论(0) 推荐(0)
超出9行的文字隐藏
摘要:text-overflow: -o-ellipsis-lastline; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 9;//这里控制行数 -webkit-box-orien... 阅读全文
posted @ 2015-06-20 22:55 Alone_Learner 阅读(142) 评论(0) 推荐(0)
正则~各位数前面补零
摘要:(today.getMonth()+1).toString().replace(/^(\d)$/,'0$1') 阅读全文
posted @ 2015-06-20 22:54 Alone_Learner 阅读(701) 评论(0) 推荐(0)
通过id TagName className 获取
摘要:/*-------------------------- + 获取id, class, tagName +-------------------------- */var get = { byId: function(id) { return typeof id === "string" ? d... 阅读全文
posted @ 2015-06-20 22:53 Alone_Learner 阅读(412) 评论(0) 推荐(0)
清除浮动
摘要:.clearfix:after{content: "";display: block;clear: both;}.clearfix{zoom:1;} 阅读全文
posted @ 2015-06-20 22:52 Alone_Learner 阅读(100) 评论(0) 推荐(0)
数字排序
摘要:function compare(value1,value2){ return value1 - value2; } var values = [1,0,10,1,5]; values.sort(compare); alert(values); 阅读全文
posted @ 2015-06-20 22:50 Alone_Learner 阅读(110) 评论(0) 推荐(0)
拖拽函数
摘要://oDrag为容器最大宽高的标准。//handle为点击拖拉移动的地方。function drag(oDrag, handle){ handle.onmousedown = function(event){ var event = event||window.event; var maxW =... 阅读全文
posted @ 2015-06-20 22:49 Alone_Learner 阅读(221) 评论(0) 推荐(0)