javascript to ajax(一)
来源:互联网 发布:java自动生成代码框架 编辑:程序博客网 时间:2024/05/16 12:23
AJAX 在浏览器与 Web 服务器之间使用异步数据传输(HTTP 请求),这样就可使网页从服务器请求少量的信息,而不是整个页面。
AJAX 基于 Web 标准
AJAX 基于下列 Web 标准:
- JavaScript
- XML
- HTML
- CSS
在 AJAX 中使用的 Web 标准已被良好定义,并被所有的主流浏览器支持。AJAX 应用程序独立于浏览器和平台。
Deafault.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="XmlWeb._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function ajaxFunction() {
var xmlhttp;
try {
xmlhttp = new XMLHttpRequest();
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
alert("浏览器不支持ajax");
}
}
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
document.form1.time.value = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "time.aspx", true);
xmlhttp.send(null);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="text" name="username" onkeyup="ajaxFunction();" />
<input type="text" id="time" name="time" />
</div>
</form>
</body>
</html>
time.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="time.aspx.cs" Inherits="XmlWeb.time" %>
<%
Response.Expires = -1;
Response.Write(DateTime.Now);
%>
- javascript to ajax(一)
- Using the Dojo JavaScript Library to Build Ajax Applications一书翻译完毕
- Using the Dojo JavaScript Library to Build Ajax Applications一书翻译完毕
- javascript 之AJAX(一)
- JavaScript学习笔记一AJAX和JSON
- javascript中的ajax对象(一)
- 原生JavaScript实现Ajax(一):XMLHttpRequest
- Ajax使用一+javascript解析Ajax返回的json字符串
- Understanding AJAX: Using JavaScript to Create Rich Internet Applications
- Dojo: Using the Dojo JavaScript Library to Build Ajax Applications
- ajax学习笔记一:面向对象的javascript
- 纯javaScript脚本来实现Ajax功能例子一
- javascript ajax
- javascript , ajax
- javascript ajax
- Ajax(Javascript)
- Ajax && javascript
- javascript ajax
- ov3640
- python的回调函数和构造重载
- PHP 环境变量
- access中使用自己编写的函数
- VC++ 2005 (C++/CLI) 系列Web讲座
- javascript to ajax(一)
- CRichEditCtrl 超文本编辑
- Delphi经典实例1------操作Window注册表
- 各种字符编码方式详解及由来(ANSI,UNICODE,UTF-8,GB2312,GBK)
- 小巷开店问题(第三题)
- Web开发者必备的十大网站资源
- [转]QT右键菜单及位置捕捉问题
- 检测Qt for symbian前后台切换 以及 信号槽使用的注意事项
- Oracle 小知识 总结(一)