03 2014 档案
摘要:多行文字实现垂直居中 现在我们要使这段文字垂直居中显示! div#wrap { border:1px solid #FF0099; background-color:#FFCCFF; width:760px; height:500px; position:relative; } div#subwrap { position:absolute; border:1px solid #000; top:50%; } div#content { border:1px solid #000; position:relative; t...
阅读全文
摘要:程序调用自身的编程技巧称为递归。//汉诺塔的游戏,n为圆盘编号数量,编号,a,b,c代表的是三个柱子var hanio=function(n,a,b,c){ if(n>0){ hanio(n-1,a,c,b); document.writeln('Move n '+n+" form "+a+' to '+c); document.write(""); hanio(n-1,b,a,c) }} hanio(3,'a','b','c')}//Move n 1 form a t
阅读全文
摘要:var People=function(){ this.name='liujinyu'; }; People.prototype={ age:24, add:function(){}, } var p1 = new People(); for(n in p1){ document.write(n+":"+p1[n]+" / "+p1.hasOwnProperty(n)); document.write(""); } //name true //age false //add false
阅读全文
摘要:var a='start111111endstart222222endasdfasdfasdfakjsfhaksdf'+'start333333endstart444444end66666666666sdfghsdfgsdg'alert(a.match(/start.*?end/img).join("=").replace(/start/g,"").replace(/end/g,"").split("="))结果111111,222222,333333,444444
阅读全文
摘要:function addCookie(name,value,expiresHours){ //添加一个cookie。 三个参数:cookie的名称、值、有效时间(为0时,关闭浏览器cookie消失) var cookieString=name+"="+escape(value); //判断是否设置过期时间 if(expiresHours>0){ var date=new Date(); date.setTime(date.getTime+expiresHours*3600*1000); cookieString=cookieString+"; expires
阅读全文
摘要:/*第一种方法:通过滤镜 使用css解决的办法。 注意滤镜下的1像素透明gif的覆盖图片的路径是相对页面写的*//*注意:这个方法不适合处理img标签引入的png图片,代码太冗余了*/.banner img{azimuth: expression(this.pngSet?this.pngSet=tr...
阅读全文