随笔分类 -  javascript

摘要:1 2 3 4 5 手风琴菜单 6 13 49 50 51 52 53 54 55 第一个56 57 58 59 第二个60 61 62 63 第三个64 65 66 67 第四个68 69 70 71 72 阅读全文
posted @ 2013-07-09 10:24 梦飞无颜 阅读(251) 评论(0) 推荐(0)
摘要:这个效果要注意几点:1.注意碰撞检测。2.注意两个元素之间的距离,原理是根据三角形定理。废话不多说,有不明白的地方可以qq我或者留言,大家一起讨论,谢谢!无标题文档 1 2 3 4 5 6 7 8 9 10 11 12 阅读全文
posted @ 2013-07-01 14:50 梦飞无颜 阅读(1521) 评论(0) 推荐(0)
摘要:闲来无事,在网上闲逛的时候开到有人说百度蛇年的贪吃蛇logo小游戏不错,于是乎就自己仿照写了一个。(注:所有素材都来自百度)效果图用到的图片 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 阅读全文
posted @ 2013-06-03 15:48 梦飞无颜 阅读(287) 评论(0) 推荐(0)
摘要:前段时间听说了一个问题,说是,javascript中使用+=来拼接字符串会比使用Array的join方法慢几十倍以上,今天在工作间歇,就写了个例 子验证了一下,结果确完全相反,使用+=比join要快(在50000个简单拼接循环)200多milliseconds,真是很意外,最后经过仔细研 究,发现原因再于,我使用的测试环境,Firefox(Ubutun), 呵呵,原来是这样的。 在IE下,确实使用Join要比+=快几十倍,但,在IE下它们整体要比firofox慢1个数量级; 在ie下解释为什么+=比join慢的原因,是因为,在IE下,String是固定内存的,每次+=都会重新分配内存。而使用A 阅读全文
posted @ 2013-05-03 16:33 梦飞无颜 阅读(161) 评论(0) 推荐(0)
摘要:1 <!doctype html> 2 <html> 3 <head> 4 5 <style type="text/css"> 6 .f{ height:500px; width:20px; background:#CCC; position:absolute; top:100px; left:458px;*top:15px} 7 .z{ height:50px; position:absolute; width:20px; background:#F00;} 8 .div{ width:0; height:... 阅读全文
posted @ 2013-04-24 17:39 梦飞无颜 阅读(459) 评论(0) 推荐(0)
摘要:1 2 3 4 5 无标题文档 6 12 13 14 15 16 17 18 19 20 21 22 fdsfsfsfsdfsdfsdfs 23 24 25 26 27 28 29 123 124 125 阅读全文
posted @ 2013-04-22 11:47 梦飞无颜 阅读(269) 评论(0) 推荐(0)
摘要:仿flash图片展示控件:function getStyle(obj, name){ if(obj.currentStyle) { return obj.currentStyle[name]; } else { return getComputedStyle(obj, false)[name]; }}function startMove(obj, attr, iTarget){ clearInterval(obj.timer); obj.timer=setInterval(function (){ var... 阅读全文
posted @ 2013-04-17 17:53 梦飞无颜 阅读(389) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; c 阅读全文
posted @ 2013-04-17 16:15 梦飞无颜 阅读(195) 评论(0) 推荐(0)
摘要:简单实用的下拉级联菜单(原生js): 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 5 <head> 6 7 <meta http-equiv="Content-Type" content=" 阅读全文
posted @ 2013-04-16 14:54 梦飞无颜 阅读(216) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; c 阅读全文
posted @ 2013-04-16 10:17 梦飞无颜 阅读(179) 评论(0) 推荐(0)
摘要:层的拖拽(转载),本人在原来的基础上完善了一下: 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" c 阅读全文
posted @ 2013-04-12 12:02 梦飞无颜 阅读(217) 评论(0) 推荐(0)