Ajax Lesson 4
来源:互联网 发布:python的集成开发环境 编辑:程序博客网 时间:2024/05/16 07:55
1.读取响应首部
主要Code
function doHeadRequest(request,url,handle)
{
alert("start head");
requestType=request;
createHttpRequest();
xmlhttp.onreadystatechange=handle;
xmlhttp.open("HEAD",url,true);
xmlhttp.send(null);
}
function defaultHeadStateHandleFunction()
{
if(xmlhttp.readystate==4)
{
if(requestType=="allResponseHeaders")
{
getAllResponseHeader();
}else if(requestType=="lastModified")
{
getLastModified();
}else if(requestType=="isResourceAvailable")
{
getIsResourceAvailable();
}
}
}
function defaultHandleFunction()
{
if(xmlhttp.readystate==4)
if(xmlhttp.status ==200)
{
doResponsed(); //Need Define yourselef.
}
}
function getAllResponseHeader(){
alert(xmlhttp.getAllResponseHeaders());
}
function getLastModified(){
alert("Last Modified:"+xmlhttp.getResponseHeader("Last-Modified"));
}
function getIsResourceAvailable()
{
if(xmlhttp.status==200)
{
alert("Successful response");
}else
if(xmlhttp.status==404)
{
alert("Resource is Unavailable");
}else
{
alert("UnExpected Response status:"+xmlhttp.status);
}
}
Read.html 内容
http://www.w3.org/TR/html4/loose.dtd">
Reading Response Headers
Read All Response headers
Read Last Modify
Read Available Resource
Read Available Resource
注: 页面调用使用javascript:functionName ,javaScript 区分大小写.所以写的时候一定要注意.否则会出现对象无效错误.
2.动态刷新页面.
Dynai..html
http://www.w3.org/TR/html4/loose.dtd">
Ajax Dynamic Update Example
This page will automaticlly update itself:
Page Will Refresh in 5 Seconds..
注.1.主要代码.SetTimeOut(function,timegap)可以固定timegap时间调用function执行.
2.需要服务器端响应.
- Ajax Lesson 4
- Ajax Lesson 3
- Lesson 4
- lesson 4
- LESSON 1 -part 4
- 新概念英语 lesson 4
- 孙鑫MFC:Lesson 4
- Java SE Lesson 4
- Lesson 4 按键
- lesson 4 磁盘
- lesson 4 communication pattern
- Lesson 4 Nehe
- lesson 4:多态
- New Concept English 2 -- Lesson 3 and Lesson 4
- LESSON 1 -part 4 answers
- Lesson 4 An Exciting trip
- Oracle Lesson 4 数据库对象
- Codility Lesson 4 NumberOfDiscIntersections 解答
- Vertex Shaders
- hibernate集合映射inverse和cascade详解
- Ajax技术简介
- 使用typeid和RTTI C++获取对象运行时类名称
- 浅析Eclipse建模框架(EMF)及其动态能力
- Ajax Lesson 4
- 利用jar指令生成jar文件和war文件
- 流水帐:我与敏捷方法
- asp 新建文件并写入内容
- 关于导入 导出Excel文件
- jQuery中文入门指南,翻译加实例,jQuery的起点教程
- Ajax Modules 个人整理
- 开通自己的Blog了
- C51中变量的存储