2015年6月20日
摘要: 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 阅读(106) 评论(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 阅读(213) 评论(0) 推荐(0) 编辑
  2015年5月28日
摘要: 响应式布局Max Width下面的样式会在可视区域的宽度小于 600px 的时候被应用。(放在里面)12345 @media screen and (max-width: 600px) { .class { background: #ccc; }}如果你想链接到一个单独的样式表,把下面的代... 阅读全文
posted @ 2015-05-28 14:05 Alone_Learner 阅读(118) 评论(0) 推荐(0) 编辑
  2015年5月27日
摘要: 图片预处理。var img = document.getElementsByTagName('img'); /*下面这句是做图片的预加载。*/ var myDiv = document.getElementsByTagName('div')[0]; for(var i = 0;i < img.len... 阅读全文
posted @ 2015-05-27 12:51 Alone_Learner 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 1,//原型function Box(){}//构造函数函数体内什么都没有,这里如果有,叫做实例属性,实例方法Box.prototype.name ='Lee';//原型属性Box.prototype.age =100;//原型属性Box.prototype.run = function (){ /... 阅读全文
posted @ 2015-05-27 12:40 Alone_Learner 阅读(171) 评论(0) 推荐(0) 编辑
摘要: js事件详解 ●一般事件onclick 鼠标点击时触发此事件ondblclick 鼠标双击时触发此事件onmousedown 按下鼠标时触发此事件onmouseup 鼠标按下后松开鼠标时触发此事件onmouseover 当鼠标移动到某对象范围的上方时触发此事件onmousemove 鼠标移动时触发此... 阅读全文
posted @ 2015-05-27 12:38 Alone_Learner 阅读(1417) 评论(0) 推荐(0) 编辑