- 博客(20)
- 资源 (2)
- 收藏
- 关注
转载 Webpack 前端工程化入门学习课程
https://gitbook.cn/gitchat/column/59e065f64f7fbe555e479204/topic/59e96d31a35cf44e19f01917
2019-01-02 16:01:48
256
转载 webpack 4.0打包报错webpack-cli的解决办法
https://blog.youkuaiyun.com/u012443286/article/details/79504289(webpack 4.0打包报错webpack-cli的解决办法)
2018-04-28 10:24:31
1914
原创 js函数自执行的写法
(function abc(){ console.log("会自动执行")}())(function abc(){ console.log("会自动执行");}())void function(){ console.log("会自动执行")}();这个写法跟!function (){console.log("我跟上面的那个写法一样的")}();...
2018-03-19 11:19:06
308
转载 淘宝适配js
<script src="http://g.tbcdn.cn/mtb/lib-flexible/{{version}}/??flexible_css.js,flexible.js"></script>
2018-03-17 15:15:31
426
转载 pc到手机端的切换js
http://www.shejidaren.com/the-best-way-to-detect-a-mobile-device.html
2017-11-29 09:43:59
457
原创 淘宝省市区街道js代码
!(function(b) { b.fn.Address = function(k) { var F = b.extend({ callback: function() {} }, k); b(this).bind("click", function() { l.css("displ
2017-11-28 14:55:12
3971
转载 jQuery $.ajax传递数组的traditional参数传递必须true
起初我认为traditional:true,可有可无,但是后来不用traditional的时候,发现后台无法获取selectUsers的值,那么可以肯定的是traditional默认值是false.当提交的参数是数组( {selectUsers:[value,value,value]} ),如果是false的话,则提交时会是"selectUsers[]=value&selectUsers[]=
2017-10-24 09:23:57
207
原创 iframe
var cigarLength=$(window.top.$(".templete_tanchuan_class iframe")).contents().find(".templete_tanchuan_Main .p1 i").html()[找指定iframe里面的元素] $(window.parent.document).contents().find("#iframe")[0].c
2017-10-20 10:24:15
231
转载 构造函数中的this和prototype
var x=100;var y=77;var a1={x:99,xx:function(){alert(y)alert(this.x)}}//a1.xx();//77,99,这里把a1中的this默认指向了a1//a1.xx.call(window);//77,100,因为把a1中的this指向了windowvar jj=a1.xx;//jj定义在全局对
2017-08-22 10:27:29
329
转载 ajax中的新写法
http://www.ruanyifeng.com/blog/2011/08/a_detailed_explanation_of_jquery_deferred_object.html
2017-08-10 11:55:18
309
原创 时间
showTime();function showTime(){var data=new Date();var Year=data.getFullYear();var Month=data.getMonth()+1;var Day=data.getDate();var Time=data.getHours();var Minutes=data.getMinutes();
2017-07-18 17:09:43
178
原创 const只读
const声明一个只读的常量。一旦声明,常量的值就不能改变。如果改变的话,会报错const PI=3.1415;console.log(PI);PI=2.11;console.log(PI);像上面这种情况,第二个会报错,因为const定义之后不能再改变,它只能读不能再设置
2017-07-18 14:45:53
372
原创 var和let的区别
var x="123";var jq=true;if(jq){let x;x='423';console.log("里面的x"+x);}console.log("外面的x"+x);var就相当于一个全局变量,let相当于一个局部变量,只在if里面有作用,不会改变外面的x的值,只会改变if里面的,所以跳出if打印出来的x还是123,而if里面的就变成了423了
2017-07-18 14:06:38
358
原创 js常用的自带的函数属性
push() 方法可向数组的末尾添加一个或多个元素,并返回新的长度function pushfun(){var Arr=['第一个','第二个','第三个','第四个'];Arr.push("第五个");console.log("新的数组"+Arr);}pop()删除 数组的最后一个元素function popfun(){var Arr=['
2017-07-13 14:34:42
581
原创 动态添加script
function addScript(src){var script=document.createElement("script");script.setAttribute("type","text/javascript");script.src=src;document.body.appendChild(script)}
2017-05-02 19:52:59
2131
原创 识别pc和手机版跳转不同的页面
function browserRedirect(partMent) { var sUserAgent= navigator.userAgent.toLowerCase(); var bIsIpad= sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs= sUserAgent.match(/iphone os/i) == "ipho
2017-04-21 11:20:22
1630
原创 第一天学闭包
闭包是指有权访问另一个函数作用域中的变量的函数,就是在一个函数内部创建另一个函数,通过另一个函数访问这个函数的局部变量;好处就是:可以把局部变量驻留在内存中,可以避免使用全局变量,缺点就是闭包作用域中返回的局部变量不会被立即销毁,可能会暂用大量的内存function box1(){var user='Lee';return function(){return user;}
2017-04-15 10:27:28
148
原创 随机
/*在n到m之间随机选一个*/function suiji(n,m){var sunif(nsun=m-n;//大数减去小数,得到要可以选择的数的个数,之后加上最小的那个数,是为了选择的值在范围之内return_jiegu=Math.floor(Math.random()*sun+n);}else{sun=n-m;return_jiegu=Math.floor(
2017-04-14 11:10:45
214
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人