以前开发用了很多AJAX的技术比如EXT,prototype,jQuery等等,但都是开源封装好的AJAX框架。从没真正用过纯正的AJAX,故参照prototyp面向对象思想自己封装了一个AJAX框架。希望能给读者参考、帮助、评价。
/* * 自己封装的ajax * * * @author 姜松 * @version 1.00 $date:2009-07-02 * * history: * */ Object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } return destination; }; Object.extend(String.prototype, { include: function(pattern) { return this.indexOf(pattern) > -1; }, startsWith: function(pattern) { return this.indexOf(pattern) == 0; }, endsWith: function(pattern) { return this.lastIndexOf(pattern) == (this.length - pattern.length); }, empty: function() { return /^\s*$/.test(this) || this == undefined || this == null; } }); Object.extend(Array.prototype, { each: function(iterator) { try { for (var i = 0, length = this.length; i 1) { for(var i = 0, elements = [], length = arguments.length; i = 0) { option = element.options[index]; value = option.value == (undefined || '') ? option.text : option.value; } return [element.name, value]; }, selectMany: function(element) { var value = []; for(var i = 0; i