随笔分类 -  WEB前端

摘要:引 chrome, safari, firefox, ie 9都支持 localStorage. 但可恶的是,中国 ie 6 占有最大的比例。 使用 cookie 不但容量有限,而且给我们增加了不少的带宽,也进行影响网站的性能。 所以我写了 localStorage.js 来模拟 localStorage, 这样其它js 就跨浏览器地使用localStorage了. 代码 if(!window.l... 阅读全文
posted @ 2011-03-17 14:37 napoleon_liu 阅读(1782) 评论(0) 推荐(0)
摘要:最近在写一个页面,在出了ie6外的所有浏览器中都正常(ie7,8,9, firefox, chrome), IE6下提示 “无法设置selected属性。未指明的错误”。 后来发现是jquery 在 ie6 下操作 select控件有BUG. 我程序中是这样使用的: $("#genre").val(0); 改成: setTimeout(function(){ $("#genre").val(0)... 阅读全文
posted @ 2011-03-14 14:35 napoleon_liu 阅读(2842) 评论(0) 推荐(0)
摘要:function update_page_list(page_bar, total, cur_page,num__per_page) { page_bar.html(""); if(total<=0) return; var num_page = ~~((total+num__per_page-1)/num__per_page); if(cur_page > 1) { page_bar.... 阅读全文
posted @ 2011-03-09 19:19 napoleon_liu 阅读(3835) 评论(5) 推荐(1)
摘要:简介: 很多应用譬如监控、即时通信、即时报价系统都需要将后台发生的变化实时传送到客户端而无须客户端不停地刷新、发送请求。本文首先介绍、比较了常用的“服务器推”方案,着重介绍了 Comet - 使用 HTTP 长连接、无须浏览器安装插件的两种“服务器推”方案:基于 AJAX 的长轮询方式;基于 iframe 及 htmlfile 的流方式。最后分析了开发 Comet 应用需要注意的一些问题,以及如... 阅读全文
posted @ 2011-03-02 09:30 napoleon_liu 阅读(372) 评论(0) 推荐(0)