上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页
摘要: ajax.request("ajax.html",{v:Math.random(),num:1},function(data){ //do something},'get');var ajax = {//Xmlhttprequest类 Xmlhttprequest: function () { this.xhr = false; },//外部调用接口 request: function (url, data, callback, type) {//每次都创建一个Xmlhttprequest的对象,使ajax调用互不影响 var xhr = ... 阅读全文
posted @ 2013-12-11 12:25 sexy_girl 阅读(254) 评论(0) 推荐(0) 编辑
摘要: var $ = function (id) { return document.getElementById(id); } //返回dom元素的当前某css值 var getCss = function (obj, name) { //ie if (obj.currentStyle) { return obj.currentStyle[name]; } //ff else { var style = document.defaultView.get... 阅读全文
posted @ 2013-12-11 11:50 sexy_girl 阅读(566) 评论(0) 推荐(0) 编辑
摘要: //根据ID返回dom元素 2 var $ = function(id){return document.getElementById(id);} 3 //返回dom元素的当前某css值 4 var getCss = function(obj,name){ 5 //ie 6 if(obj.currentStyle) { 7 return obj.currentStyle[name]; 8 } 9 //ff10 else {11 var s... 阅读全文
posted @ 2013-12-11 11:38 sexy_girl 阅读(156) 评论(0) 推荐(0) 编辑
摘要: function Queue() { this.data = []; } Queue.prototype = { processTime: 20, add: function (fn, params, context) { this.data.push({ fn: fn, params: params, context: context }); }, start: functio... 阅读全文
posted @ 2013-12-11 11:31 sexy_girl 阅读(145) 评论(0) 推荐(0) 编辑
摘要: var origDoSomething = Thing.prototype.doSomething;Thing.prototype.doSomething = function() { var start = Date.now(); var result = origDoSomething.apply(this, arguments); console.log((Date.now() - start) + 'ms', x, y, result); return result;} 阅读全文
posted @ 2013-12-10 17:27 sexy_girl 阅读(132) 评论(0) 推荐(0) 编辑
摘要: slice = Array.prototype.slice,// Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { if ( typeof context === "string" ) { var tmp = fn[ context ]; context = fn; fn = tmp; } // Quick... 阅读全文
posted @ 2013-12-10 16:46 sexy_girl 阅读(185) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2013-11-14 15:33 sexy_girl 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 我们常用的script标签,有两个和性能、js文件下载执行相关的属性:defer和asyncdefer的含义【摘自https://developer.mozilla.org/En/HTML/Element/Script】This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed.async的含义【摘自https://developer.mozilla.org/En/HTML/Element/Scr 阅读全文
posted @ 2013-11-12 16:14 sexy_girl 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 什么是跨域1、document.domain+iframe的设置2、动态创建script3、利用iframe和location.hash4、window.name实现的跨域数据传输5、使用HTML5 postMessage6、利用flash本文来自网络(http://f2e.me/200904/cross-scripting/,该网址已不能访问),仅作个人读书笔记之用,并稍作修改和补充。什么是跨域JavaScript出于安全方面的考虑,不允许跨域调用其他页面的对象。但在安全限制的同时也给注入iframe或是ajax应用上带来了不少麻烦。这里把涉及到跨域的一些问题简单地整理一下:首先什么是跨域, 阅读全文
posted @ 2013-11-07 16:33 sexy_girl 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 对于大多数浏览器而言,有三种刷新方式:F5Ctrl+F5“转至”或地址栏里回车而这三种刷新方式会导致浏览器采取不同的缓存机制:F5:不允许浏览器直接使用本地缓存,因此Last-Modified能起作用,但Expires无效Ctrl+F5:是强制刷新,因此缓存机制失效“转至”或地址栏里回车:正常的访问... 阅读全文
posted @ 2013-11-01 11:14 sexy_girl 阅读(219) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页