摘要: 前段时间听说了一个问题,说是,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 梦飞无颜 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 针对6大主流浏览器(Chrome,Firefox,Safari,Opera,Maxthon,IE6,7,8),单位为px.一.h1~h6标签:有默认margin(top,bottom且相同)值,没有默认padding值。在chrome中:16,15,14,16,17,19;在firefox中:16,15,14,16,17,20;在safari中:16,15,14,16,17,19;在opera中:16,15,14,14,17,21;在maxthon中:16,14,14,15,16,18;在IE6.0中:都是19;在IE7.0中:都是19;在IE8.0中:16,15,14,16,17,19;二. 阅读全文
posted @ 2013-04-26 15:50 梦飞无颜 阅读(487) 评论(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 梦飞无颜 阅读(451) 评论(0) 推荐(0) 编辑
摘要: 你对CSS中单位px和em的区别是否了解,这里和大家分享一下,px像素(Pixel),相对长度单位,像素px是相对于显示器屏幕分辨率而言的;而em也是相对长度单位,相对于当前对象内文本的字体尺寸。如当前对行内文本的字体尺寸未被人为设置,则相对于浏览器的默认字体尺寸。彻底弄懂CSS中单位px和em的区别国内的设计师大都喜欢用px,而国外的网站大都喜欢用em,那么两者有什么区别,又各自有什么优劣呢?1.IE无法调整那些使用px作为单位的字体大小;2.国外的大部分网站能够调整的原因在于其使用了em作为字体单位;3.Firefox能够调整px和em,但是96%以上的中国网民使用IE浏览器(或内核)。p 阅读全文
posted @ 2013-04-24 12:06 梦飞无颜 阅读(134) 评论(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 梦飞无颜 阅读(255) 评论(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 梦飞无颜 阅读(380) 评论(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 梦飞无颜 阅读(183) 评论(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 梦飞无颜 阅读(207) 评论(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 梦飞无颜 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1. 禁用右键点击(Disable right-click)[javascript] view plaincopyprint?$(document).ready(function(){$(document).bind("contextmenu",function(e){returnfalse;});});2. 禁用搜索文本框(Disappearing search field text)[javascript] view plaincopyprint?$(document).ready(function(){$("input.text1").val(&q 阅读全文
posted @ 2013-04-15 17:35 梦飞无颜 阅读(198) 评论(0) 推荐(0) 编辑