CSS代码:.trans-fadeout{ -webkit-transition:all 0.5s linear; -moz-transition:all 0.5s linear; -ms-transition:all 0.5s linear; -o-transition:all 0.5s linear; transition:all 0.5s linear;}.image-fadeout{position:absolute; margin-top:20px; visibility:hidden; opacity:0;}.hover-fadeout:hover .image... Read More
posted @ 2013-05-23 17:45 人 在 旅 途 Views(1317) Comments(0) Diggs(0)
1、获取包含中文在内的字符串长度一个中文长度为二;function getStrLength(str) { var cArr = str.match(/[^\x00-\xff]/ig); return str.length + (cArr == null ? 0 : cArr.length); } 2、无乱码字符串截取,如: var a="www.cnblogs.com";a.sub(3)//返回wwwString.prototype.sub = function(n){var r = /[^\x00-\xff]/g;if(this.replace(r, "mm& Read More
posted @ 2013-05-22 10:08 人 在 旅 途 Views(195) Comments(0) Diggs(0)
最近接到的项目中,图片轮播相当多,为了减少重复工作和麻烦,干脆封装了一个1、cssdiv{position: relative;width: 555px;margin: 0 auto;height: 175px;overflow: hidden}img{display: block;width: 175px;height: 175px;position: absolute;top: 0;margin: 0 10px;}2、html<div> <img id="list_0" /> <img id="list_1" /> Read More
posted @ 2013-05-21 11:39 人 在 旅 途 Views(201) Comments(0) Diggs(0)
javascript很灵活,可以有各种编程风格 //函数式 function startAnimation(){ //... } function stopAnimation(){ //... } //类式 function Animation(){ this.start = function(){} this.stopj = function(){} } //原型1 var Animation = function(){} Animation.prototype... Read More
posted @ 2013-05-20 15:58 人 在 旅 途 Views(182) Comments(0) Diggs(0)
好久没有做这个兼容问题了,都是单浏览器内核开发;从网上找了点资料,温习一下。网页开发经常要用到javascript,而每个浏览器对javascript的支持有不同。这就需要我们去兼容他们,不然有些浏览器就无法运行我们的代码。就会造来客户的投诉,如果让BoSS知道了,这可不太好哦。下面是兼容IE和FF的js脚本做法和分解(部分选自网上):.以下以 IE 代替 Internet Explorer,以 MF/FF 代替 Mozzila Firefox//window.eventIE:有window.event对象FF:没有window.event对象。可以通过给函数的参数传递event对象。如onm Read More
posted @ 2013-05-14 18:46 人 在 旅 途 Views(176) Comments(0) Diggs(0)
在Baranovskiy博客中看到一篇So, you think you know JavaScript?的博客,http://dmitry.baranovskiy.com/post/91403200Quick test for real understanding of JavaScript core beyond closures and scopes. Here five small scripts. Try to answer what will be alerted in each case without running them in the console. Then you Read More
posted @ 2013-05-10 12:59 人 在 旅 途 Views(186) Comments(0) Diggs(0)
给节点对象添加事件html代码:<body> <div> <ul> <li>0</li> <li>1</li> <li>2</li> <li>3</li> </ul> </div></body>添加事件方法1:var add_mouse_events = function(nodes){ var i; for(i=0;i<nodes.length;i+=1){ nodes[i].onclick = function(i){ Read More
posted @ 2013-05-08 16:41 人 在 旅 途 Views(240) Comments(0) Diggs(0)
一、通过给Function.prototype增加方法来使得该方法对所有函数可用Function.prototype.method = function(name,func){ if(!this.prototype[name]){ this.prototype[name] = func; return this; } }通过上面的method方法给Number扩展一个取整的方法integerNumber.method('integer',function(){ return Math[this < 0 ... Read More
posted @ 2013-05-03 17:15 人 在 旅 途 Views(173) Comments(0) Diggs(0)
1、figure元素作用:典型的用途是包含图像例子:<figure> <img src="example.jpg alt="示例图片"/></figure>2、figcaption元素作用:有一些注解内容需要使用一个简短的标题例子:<figure> <img src="example.jpg alt="示例图片"/> <figcaption>这个示例图片,帮助理解</figcaption></figure>3、mark元素作用:文字突出显示 Read More
posted @ 2013-05-02 11:24 人 在 旅 途 Views(305) Comments(0) Diggs(0)
1、section元素作用:按主题对内容进行分组,如文章正文内容的章节,或者网站上相同页面的区域,如介绍、产品的展示和联系表单。例子:1 <section>2 <!--博客文章-根据需要可重复出现多次-->3 </section>2、header元素作用:定义一个特定的网站区域,其中可以包含标题、logo、导航以及其他与页眉相关的内容。例子: 1 <header> 2 <!-- 网站名称和导航 --> 3 <h1>My amazing blog</h1> 4 <nav> 5 <ul> 6 Read More
posted @ 2013-04-28 16:17 人 在 旅 途 Views(287) Comments(0) Diggs(0)