易截截图软件、单文件、免安装、纯绿色、仅160KB

封装一个简单的Ajax函数

/**
* Ajax操作函数
*
* @param url -- 服务器端页面地址
* @param param -- 参数,类似 'user=123&id=100'
* @param method -- 请求服务器端的方法,Get和Post两种,默认是GET
* @param response -- 是否获取服务器端返回的结果,默认是true
*/
function ajax( url, param, method, response ){
//set default value
param = typeof(param)=='undefined' ? '' : param;
method = typeof(method)=='undefined' ? 'GET' : method;
response = typeof(response)=='undefined' ? true : response;
//get ajax object
var ajax = null;
try {
   ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
   try {
    ajax = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (E) {
    ajax = null;
   }
}
if (!ajax && typeof XMLHttpRequest!='undefined'){
   ajax = new XMLHttpRequest();
}
if (!ajax){
   alert("Get ajax object failed");
   return false;
}
//send http request
var res = '';
if (method != 'GET'){
   method = 'POST';
}
if (method == 'GET'){
   ajax.open('GET', url + param, true);
   ajax.onreadystatechange = function(){
    if (ajax.readyState==4 && ajax.status==200){
     res = ajax.responseText;
    }
   }
   ajax.send(null);
}
if (method == "POST"){
   ajax.open("POST", url, true);
   ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
   ajax.send(param);
   ajax.onreadystatechange = function() {
    if (ajax.readyState==4 && ajax.status==200) {
     res = ajax.responseText;
    }
   }
}
if (response){
   return res;
}
return null;
}


相关文档:

AJAX实现的多人协同设计


Download board.zip - 39.6 KB - Old Version 
Download board_2008.zip - 55.03 KB  - Latest VS 2008 Version
Introduction  
This is an AJAX based WhiteBoard application. Typically unlike their desktop based counterparts, web applications need to be designed to use optimal ......

AJAX典型函数

function createXMLHttpRequest() {   // 创建XMLHTTPREQUEST的标准函数.兼容各浏览器.
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (wind ......

10种AJAX/JavaScript特效实例让你的网站更吸引人

 今天的话题是如何改进自己网站的界面或提高网站的视觉体验,从而让用户记忆犹新。
  我们有三种主要的方法(从难到易):自己动手写脚本;使用类似于jQuery和mooTools的JavaScript框架(可以让编写代码变得更容易些);使用能工作于现有的JavaScript框架下的提前预置好的脚本或那种从头开始开发的创建者。这篇文章适合那 ......

visual studio 2008 安装AJAX Version 3.0.30930

1.到http://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33804
下载AJAX Control Toolkit - Binary
2.解压到C:\Program Files\Microsoft.NET\ADOMD.NET\90
3.visual studio 新建一网站,双击default.aspx
4.打开工具箱,右击新建一选项卡,明名为Ajax Control Toolkit
5.右击Ajax Contr ......

AJAX框架/RIA 共收录了 57 个 JavaScript 项目


Ajax框架 jQuery
jQuery是一款免费且开放源代码的JavaScript代码库,由John Resig创建。授权协议为GPL和MIT许可证双协议。示例代码: $("p.neat").addClass("ohmy").show("slow"); 特点轻量级经GZip压缩后传输的代码文件仅14KB,未经压缩传送的代码文件仅26KB。 jQuery 1.26版时: 档案档案行数档案Size 备注 jquery-1.2 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号