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

Ajax使用示例

/***************************by
garcon1986********************************/
Index.php:
<script type="text/javascript" src="ajax.js" ></script>
<a href="#" onclick="funphp('S')" >S</a>
<a href="for.php?url=E" >E</a>
<div id="idiv"></div>
for.php:
<?php
error_reporting(E_ALL ^ E_NOTICE);
if($url = $_GET[url]){
for($i=1;$i<10;$i++){
echo $url;
}
exit();
}
?>
Ajax.js:
//首先声明变量
var xmlHttp;
//创建对象函数
function GetXmlHttpObject(){
try{
//Firefox, Opera, Safari
xmlHttp = new XMLHttpRequest();
}
catch(e){
try{
//MS IE 6.0+
xmlHttp = new ActiveXObject(Msxml2.XMLHTTP);
}
catch(e){
try{
//MS IS 5.5+
xmlHttp = new ActiveXObject(Microsoft.XMLHTTP);
}
catch(e){
alert("您的浏览器不支持AJAX!");
return false;
}
}
}
}
//发送请求函数
function funphp(t){
//调用GetXmlHttpObject函数
GetXmlHttpObject();
//open() 方法需要三个参数。第一个参数定义发送请求所使用的方法(GET 还是 POST)。第二个参数规定服务器端脚本的
URL。第三个方法规定应当对请求进行异步地处理。
xmlHttp.open("GET","for.php?url="+t, true);
//指定响应函数
xmlHttp.onreadystatechange = effect;
//发送请求。当使用GET方法时,一般send里的参数是null。如果是POST会有所不同。
xmlHttp.send(null);
}
//处理返回信息函数
function effect(){
if(xmlHttp.readyState == 4){
if(xmlHttp.status == 200){
var cao = xmlHttp.responseText;
document.getElementById('idiv').innerHTML = cao;
}
}
}
注释:
xmlHttpRequest.readyState的5种状态:
0 (Uninitialized)
The object has been created, but not initialized (the open method has
not been called).
1 (Open)
The object has been created, but the send method has not been called.
2 (Sent)
The send method has been called. responseText is not available.
responseBody is not available.
3 (Receiving)
Some data has been received. responseText is not available. responseBody
is not available.


相关文档:

Ajax信息反馈显示

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0044)http://www.qqip.cn -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>new document</TITLE>
<META ht ......

AJAX实现loading….效果

绿色通道文件都是走批,一个文件走完流程后,再查询,速度真是慢,要分别从5个表查,并且需要设置关联查询,因此在提交数据后,我希望查询这部分可以用AJAX实现,当数据未返回时,DIV里显示一个加载GIF,等数据返回后再显示提交的数据。而重复查询时也不会再提交数据和刷新,节省了很多资源.
 
   虽然我会 ......

JSON例子(struts ajax json)

来源:haoxuewu - BlogJava
  前段时间做项目用到了json,今天我抽时间写了一个struts+ajax+json的例子.
  个人感觉ajax+json在很大程度上降低了网络和服务器的IO,是一个很不错的组合!
  1:json的lib我用的是json-lib-2.1-jdk15.jar,它可以在
  2:struts用的是1.2
  3:用到了js第三方prototype.js,主 ......

ASP.NET MVC框架,ajax,jquery开发系列课程

http://www.microsoft.com/china/msdn/events/webcasts/shared/webcast/Series/MVC.aspx
http://www.cnblogs.com/chsword/archive/2009/03/11/zd_mvc1.html
jQuery框架学习:http://www.zz68.net/WebDesign/js/200907/0H611P2009.html
ASP.NET 中的设计模式之MVC篇:http://www.cnblogs.com/superhasty/archive/2005/06/08 ......

基于prototype.js的ajax分页

这是一个基于prototype.js的ajax分页,运用了spring框架,自定义分页标签,每次进入列表页面时,把列表存入session,分页只对session存储的列表进行分页,不需要再去查询数据库,性能会高些
首先在web.xml中配置spring监听和servlet
web.xml内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app versi ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号