摘要: 1.水平居中 1.1 margin:auto 把要居中的元素的margin-left和margin-right都设为auto,对浮动元素或绝对定位元素无效 1.2 text-align:center 只能对图片,按钮,文字等行内元素(display为inline或in... 阅读全文
posted @ 2015-11-09 21:15 阿狸先生 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 1:this javascript中的this总是指向一个对象的,至于是指向哪一个对象,是运行时基于函数的执行环境的动态绑定的,尔非函数被声明时的环境; this的指向可以分为四类: 作为对象的方法调用 作为普通函数调用 构造器调用 Function.prototype.call()和Functio... 阅读全文
posted @ 2015-11-08 00:04 阿狸先生 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 1:JS原型(prototype)实现继承function Person(){} person.prototype.hello="hello"; person.prototype.sayHello=function(){ alert(this.hello);}function Ch... 阅读全文
posted @ 2015-11-07 23:51 阿狸先生 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 1:社么是正则表达式?2:创建正则表达式?2.1: var reg=/pattern/;2.2: var reg=new RegExp("pattern");3:正则表达式的exec方法: reg.exec(str); //str为要执行正则表达式的字符串: index属性: input... 阅读全文
posted @ 2015-11-07 22:47 阿狸先生 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 编写一个javascript函数方法parseQueryString,把url参数解析为一个对象var url="http://www.taobao.com/index.php?key0=0&key1=1&key2=2";function parseQueryString(){ var st... 阅读全文
posted @ 2015-11-07 18:35 阿狸先生 阅读(419) 评论(0) 推荐(0) 编辑