04 2016 档案
函数自执行
摘要:function fn(){ alert(a); }; fn(); (function fn(){ alert(a); })(); 6666 (function(){ 闭包的写法也是 var。。 定义的变量可以有效的防止全局污染 })() 阅读全文
posted @ 2016-04-27 10:03 田潇 阅读(122) 评论(0) 推荐(0)
闭包理解
摘要:function fn1(){ var a=1; fuction fn2(){ alert(a++); } return fn2; } fn1();//1 fn1();//2 引用fn2的存在导致内存不会销毁a; 保护了内部的私有变量不被改变; 可调用上下文的变量; 典型应用jquery 但是不被销 阅读全文
posted @ 2016-04-27 09:53 田潇 阅读(121) 评论(0) 推荐(0)
canvas 下rem 的应用
摘要:var winWidth = window.innerWidth;var remVal = winWidth / 10; <div id="main"> <div class="demo"> <canvas width="10.0rem" height="3.125rem" > </canvas> 阅读全文
posted @ 2016-04-25 15:02 田潇 阅读(2724) 评论(0) 推荐(0)
关于 移动端 页面跳转的方赞
摘要:移动端不支持a标签 了好坑 $(".pingjia").tap(function () {// body...alert(1);window.location.href="./evaluate.html"// window.location.href="http://www.baidu.com"}) 阅读全文
posted @ 2016-04-19 17:41 田潇 阅读(365) 评论(0) 推荐(0)
关于 移动端 缓存不执行问题的解决方案
摘要:设置webview的属性如下 WebSettings settings = mWebView.getSettings(); settings.setDomStorageEnabled(true); 阅读全文
posted @ 2016-04-19 17:40 田潇 阅读(457) 评论(0) 推荐(0)
js判断对象的类型的四种方式
摘要:5种原始类型: undefined、null、bool、number、string 引用类型(new出来的) typeof undefined、object、boolean、number、string 、Object constructor undefined、null、bool、number、st 阅读全文
posted @ 2016-04-06 15:27 田潇 阅读(559) 评论(0) 推荐(0)