随笔分类 -  javascript

从主数组中删除包含的子数组内容
摘要: 阅读全文

posted @ 2015-01-14 11:37 icelin 阅读(263) 评论(0) 推荐(0)

用Javascript获取页面元素的位置
摘要:作者:阮一峰 (http://www.ruanyifeng.com/blog/2009/09/find_element_s_position_using_javascript.html)制作网页的过程中,你有时候需要知道某个元素在网页上的确切位置。下面的教程总结了Javascript在网页定位方面的... 阅读全文

posted @ 2014-09-24 16:30 icelin 阅读(176) 评论(0) 推荐(0)

angular 使用概术
摘要:框架技术细节说明must该文档详细说明了基于Angular的机制及关键技术。目录: - 路由机制 - 通过路由来切分页面模块 - Lazyload机制 - 指令 - 程序bootstrap - 数据绑定 - filters - 何时编写自定义指令 - controller之间的通信 - 依赖注入 -... 阅读全文

posted @ 2014-09-22 11:25 icelin 阅读(2815) 评论(0) 推荐(1)

http 持久连接
摘要:谈谈持久链接——用暴走漫画理解HTTP原精郭诗雨2来自:NS测试部time2014-04-09 11:23次637持久连接 什么是持久连接?顾名思义,就是"持久"的连接。之前说到过,为了完成一个HTTP事务,服务器和客户端之间要建立一条TCP连接来传输报文,这个事务结束以后一般都会直接把它关闭,这是... 阅读全文

posted @ 2014-09-16 15:05 icelin 阅读(3235) 评论(0) 推荐(0)

js 资料
摘要:http://javascript.ruanyifeng.com/#introduction2.MDN 火狐中文社区 https://developer.mozilla.org/zh-CN/docs/Web_Development 阅读全文

posted @ 2014-08-29 13:23 icelin 阅读(122) 评论(0) 推荐(0)

去除HTML选择——兼容IE、FireFox(document.onselectstart,样式)
摘要:引之:http://taoistwar.iteye.com/blog/278963今天做一个拖动效果,在网上找了个模板,作发后发现一拖动就会选择其它页面部分,需要去除这个效果,找了个模板看了下发现有如下方法:只能被IE识别,document.onselectstart=function(){retu... 阅读全文

posted @ 2014-08-27 15:19 icelin 阅读(469) 评论(0) 推荐(0)

js模板引擎
摘要:http://www.douban.com/group/topic/41272516/选型标准: 简单、通用、性能好各种JS模板引擎对比数据(高性能JavaScript模板引擎)http://blog.csdn.net/wuchengzhi82/article/details/8938122baid... 阅读全文

posted @ 2014-05-29 14:04 icelin 阅读(156) 评论(0) 推荐(0)

setTimeout和setInterval的使用
摘要:引自(http://www.cnblogs.com/qiantuwuliang/archive/2009/06/20/1507304.html)这两个方法都可以用来实现在一个固定时间段之后去执行JavaScript。不过两者各有各的应用场景。方 法实际上,setTimeout和setInterval... 阅读全文

posted @ 2014-05-14 17:35 icelin 阅读(208) 评论(0) 推荐(0)

使用canvas绘制时钟 (http://heeroluo.net/Article/Detail/95)
摘要:准备工作在HTML中指定一个区域放置时钟:时钟的一些外观设定:var width = 260; // 桌布宽度var height= 260; // 桌布高度var dot = {x : width / 2,y : height / 2,radius : 6}; // 圆点位置、半径var radius = 120; // 圆半径var borderWidth = 6; // 圆边框宽度创建元素:var clock = document.getElementById('clock');var clockBg = document.createElement('canva 阅读全文

posted @ 2014-03-30 10:17 icelin 阅读(349) 评论(0) 推荐(0)

Javascript日期类型的妙用
摘要:http://heeroluo.net/Article/Detail/110获取某个月份的天数相信大家读小学的时候就知道一年十二个月各有多少天了,这里面有个特殊的存在——2月。闰年的2月有29天,非闰年的2月只有28天。估计不少人跟我一样,已经不记得闰年的规则了,这时候,下面的这个方法就派上用场了。var date = new Date(2013, 2, 0);date.getDate(); // 28date = new Date(2012, 2, 0);date.getDate(); // 29创建Date对象时可以传入三个参数,分别是年、月、日,如果日的参数为0,那创建出来的对象表示.. 阅读全文

posted @ 2014-03-29 16:14 icelin 阅读(366) 评论(0) 推荐(0)

预加载(图片,css ,js)
摘要:图片预加载 new Image().src = 'http://img1.t.sinajs.cn/t35/skin/skin_008/skin.css'; //新浪(4)非ie下预加载(js,css) 用Objectvar doc=document;var obj=doc.createElement("object");obj.setAttribute('date','123.js');obj.style.cssText="width:0;height:0;"doc.getElementsByTagName 阅读全文

posted @ 2014-03-27 09:56 icelin 阅读(276) 评论(0) 推荐(0)

cookie 操作(转载)
摘要:/** * Create a cookie with the given name and value and other optional parameters. * * @example $.cookie('the_cookie', 'the_value'); * @desc Set the value of a cookie. * @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.c 阅读全文

posted @ 2014-03-26 17:23 icelin 阅读(230) 评论(0) 推荐(0)

replace() 所有单词首字母大写
摘要:function ReplaceDemo() { var r,re; var s="The quick brown fox jumpe dover the lazy yellow dog."; re=/\b\w+\b/g; r=s.replace(re,function(ww){ return "("+ww.slice(0,1).toUpperCase()+ww.slice(1)+")"; } ); return(r); } 阅读全文

posted @ 2014-03-21 14:54 icelin 阅读(248) 评论(0) 推荐(0)

知识点
摘要:1. new Date.getYear();返回值:(默认为当前系统时间)114;返回当前年份减去1900,不同浏览器处理结果不同firefox chrome:返回当前年代减去1900IE和opear如果年份为1900-1999,返回时间减去1900,如:1980年得到getYear时间是80,不在此年份的时间,返回四位数,规避:用new Date.getFullYear()取代;2. epxpires 格式是GMT格式;toGMTString()或toUTCString(),现在推荐使用toUTCString()方法。3.当需要判断一个变量是否为 undefined 时,直接用Js代码 a. 阅读全文

posted @ 2014-03-17 16:17 icelin 阅读(257) 评论(0) 推荐(0)

一道变态的Javascript面试题
摘要:转载http://cymoft.blog.51cto.com/324099/1260099123456789f =function() {returntrue;};g =function() {returnfalse;};(function() {if(g() && [] == ![]) {f =functionf() {returnfalse;};functiong() {returntrue;}}})();alert(f());// true or false ?此题的关键是第4行的if条件g() && [] == ![]这里有三个关键的点,第一,g()在这 阅读全文

posted @ 2014-03-17 15:54 icelin 阅读(467) 评论(1) 推荐(0)

导航