摘要: var oClor=false; /* if(oClor) { alert('红'); } else { alert('蓝'); }*/ oClor?alert('红'):alert('蓝'); 阅读全文
posted @ 2018-02-23 20:16 theshine 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 正则字符串操作:例1:search =>查找第一次出现的位置,没有返回-1var atr = 'ab12'; alert(atr.search('b'));//输出1 例2:substring =>两个参数(起始位置到结束位置的前一位) =>一个参数(起始位置一直取到整个字符串结束)var str 阅读全文
posted @ 2018-01-29 13:46 theshine 阅读(159) 评论(0) 推荐(0) 编辑
摘要: call()方法和apply()方法的作用相同,他们的区别在于接收参数的方式不同。对于call(),第一个参数是this值没有变化,变化的是其余参数都直接传递给函数。(在使用call()方法时,传递给函数的参数必须逐个列举出来。使用apply()时,传递给函数的是参数数组)如下代码做出解释: fun 阅读全文
posted @ 2017-12-09 17:42 theshine 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 完美运动框架 阅读全文
posted @ 2017-12-08 13:53 theshine 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 1.什么是继承? 2.通过面向对象方式来了解继承 (1)创建构造函数Aaa()添加属性,并赋予showName()和showSex()方法 (2) 创建构造函数Bbb(),想要继承Aaa()的属性,可以通过call方式获取 (3)原型链继承父级方法并给当前函数添加方法 阅读全文
posted @ 2017-12-02 22:44 theshine 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 报错提示 1.网上查资料发现原来'css-loader'和'style-loader'是被我全局安装了 2.正确做法cnpm install css-loader style-loader --save 3.打包运行成功 阅读全文
posted @ 2017-11-17 18:08 theshine 阅读(4350) 评论(0) 推荐(0) 编辑
摘要: Math.min()取参数中最小的,Math.max()取参数中最大的 top=Math.min(top, topMax); 等价于 if(top>topMax) { top=topMax; } 阅读全文
posted @ 2017-11-14 14:14 theshine 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 什么是表单? 向服务器提交数据,比如用户注册 action 提交到哪里 表单事件 onsubmit 提交时发生 onreset 重置时发生 示例: 阅读全文
posted @ 2017-11-08 23:06 theshine 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 监听键盘按下事件 addEventListener('keydown',function(e){ alert(e.keyCode); }) 1.存储用户按下了哪些键,不知道用户按下哪些键可以先存储 var keyDown={}; //监听键盘按下事件 addEventListener('keydow 阅读全文
posted @ 2017-11-07 01:09 theshine 阅读(805) 评论(0) 推荐(0) 编辑
摘要: var bgImg=new Image(); bgImg.src=图片路径; c.drawImage(bgImg,0,0,imgwidth,imgheight) 阅读全文
posted @ 2017-11-06 23:15 theshine 阅读(221) 评论(0) 推荐(0) 编辑