摘要: setTimeout 设置定时器,2秒钟后,执行一次,并且只执行一次, 定时炸弹 clearTimerout清楚定时器,清理setTimerout setInterval设置定时器,每两秒执行一次 clearInterval清楚定时器,清理setInterval arguments实参的元素集合 p 阅读全文
posted @ 2016-08-04 15:08 涂先庆 阅读(88) 评论(0) 推荐(0) 编辑
摘要: js应用实例 1.altKey 描述: 检查alt键的状态。 语法: event.altKey 可能的值: 当alt键按下时,值为 TRUE ,否则为 FALSE 。只读。 2.button 描述: 检查按下的鼠标键。 语法: event.button 可能的值: 0 没按键 1 按左键 2 按右键 阅读全文
posted @ 2016-08-04 14:53 涂先庆 阅读(89) 评论(0) 推荐(0) 编辑
摘要: event代表事件的状态,例如触发event对象的元素,鼠标的位置及状态,按下的键等等。 event对象只能事件发生的过程中才有效。 event的某些属性只对特定的事件有意义。比如,fromElement和toElement属性只对onmouseover和onmouseout事件有意义。 event 阅读全文
posted @ 2016-08-04 14:48 涂先庆 阅读(119) 评论(0) 推荐(0) 编辑
摘要: <script> Date()方法获得当日的日期 <script type="text/javascript"> document.write(Date()) </script> getTime()计算从1970年到今天有多少年 <script type="text/javascript"> var 阅读全文
posted @ 2016-08-04 14:03 涂先庆 阅读(125) 评论(0) 推荐(0) 编辑
摘要: NaN是一个特殊的数量值,不表示一个数字,尽管下面的代码仍然是返回类型为number console.log(typeof NaN);//numberconsole.log(typeof NaN 'number');//true 可见typeof不能真正区分数字与NaN的区别。 为了进一步区分NaN 阅读全文
posted @ 2016-08-04 13:45 涂先庆 阅读(83) 评论(0) 推荐(0) 编辑