随笔分类 -  javascript

摘要:原文链接:http://caibaojian.com/js-splice-element.html 2:delete · delete删除掉数组中的元素后,会把该下标出的值置为undefined,数组的长度不会变 阅读全文
posted @ 2017-11-13 10:38 tangchangcai 阅读(404) 评论(0) 推荐(0)
摘要:array.splice(index包含,要删除的个数:从index算起,index位置上要添加的item) >返回新的数组 indexof: 1.string var arr = ['orange','2016','2016']; arr.indexOf(‘orange') 输出 0 因为 ‘or 阅读全文
posted @ 2017-11-13 10:30 tangchangcai 阅读(380) 评论(0) 推荐(0)
摘要:method1: '1aaa2bb3'.match(/\d/g) //return : [1,2,3] method2: '1aaa2bb3 hello world'.match('world ') //return null,是因为后面有个空格所以返回null '1aaa2bb3 hello wo 阅读全文
posted @ 2017-11-11 11:14 tangchangcai 阅读(5170) 评论(0) 推荐(0)
摘要:<a href="javascript:history.go(-1)">返回上一页</a> <a href="javascript:location.reload()">刷新当前页面</a> <a href="javascript:" onclick="history.go(-2); ">返回前两页 阅读全文
posted @ 2017-11-09 20:38 tangchangcai 阅读(13723) 评论(0) 推荐(0)
摘要:var o = {}; o.1ab = 1;//错, o['1ab']=1;//正确 阅读全文
posted @ 2017-11-09 19:51 tangchangcai 阅读(2106) 评论(0) 推荐(0)
摘要:<div class="form-block og-clearfixed"> <label>姓名<span class="helpjustify"></span></label> <input id="username" class="phone aninput" type="text" place 阅读全文
posted @ 2017-11-03 10:24 tangchangcai 阅读(598) 评论(0) 推荐(0)
摘要:refferrer: http://www.w3school.com.cn/jsref/jsref_obj_regexp.asp 注意: 在用match时, 错误的写法: 1: "dadjfaasdff".match(/d/g);//return : [d,d,d] 2: "abbbbbbbb".m 阅读全文
posted @ 2017-11-01 16:25 tangchangcai 阅读(224) 评论(0) 推荐(0)
摘要:referrer: http://www.css88.com/tool/html2js/ 阅读全文
posted @ 2017-11-01 15:35 tangchangcai 阅读(1668) 评论(0) 推荐(0)
摘要:在开始描述touch事件之前,需要先描述一下多触式系统中特有的touch对象(android和iOS乃至nokia最新的meego系统都模拟了类 似的对象)。这个对象封装一次屏幕触摸,一般来自于手指。 它在touch事件触发的时候产生,可以 通过touch event handler的event对象 阅读全文
posted @ 2017-10-31 09:36 tangchangcai 阅读(324) 评论(0) 推荐(0)
摘要:1.封装兼容事件对象EventUtil 阅读全文
posted @ 2017-10-30 20:34 tangchangcai 阅读(2909) 评论(0) 推荐(0)
摘要:referer: http://www.cnblogs.com/hykun/p/EventUtil.html#getCharCode 前言:什么是EventUtil? 在JavaScript中,DOM0级、DOM2级与旧版本IE(8-)为对象添加事件的方法不同 为了以跨浏览器的方式处理事件,需要编写 阅读全文
posted @ 2017-10-30 15:52 tangchangcai 阅读(344) 评论(0) 推荐(0)
摘要:window.event.srcElement与window.event.target 都是指向触发事件的元素,它是什么就有什么样的属性 srcElement是事件初始化目标html元素对象引用,因为事件通过元素层次冒泡,可以在任意一层进行处理, 有了元素的引用,就可以读写改元素的属性。 IE浏览器 阅读全文
posted @ 2017-10-30 15:19 tangchangcai 阅读(217) 评论(0) 推荐(0)
摘要:第三个参数false true的区别 true 在捕获节点的时候就触发事件 ,由外到内 false 在冒泡的时候才触发事件,由内到外 html: js: 阅读全文
posted @ 2017-10-30 15:12 tangchangcai 阅读(513) 评论(0) 推荐(0)
摘要:window.scripts 获取页面的<script>标签 ,返回一个数组,可以取得script的src路径 阅读全文
posted @ 2017-10-18 21:09 tangchangcai 阅读(1057) 评论(0) 推荐(0)
摘要:1.使用<script>元素 阅读全文
posted @ 2017-10-14 00:25 tangchangcai 阅读(97) 评论(0) 推荐(0)
摘要:草民我最近是看着博客园太空旷,突然手痒了就想在里面随便种种花,顺便晒晒太阳。好了,废话就不多说,直入主题。 本章内容 1.javascript 历史回顾。 1995年诞生。 2.javascript 是什么? 一门用来代替perl(服务器语言)验证表单必填项的web语言。疯狂的发展后,成为各大浏览器 阅读全文
posted @ 2017-10-13 23:40 tangchangcai 阅读(138) 评论(0) 推荐(0)