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

接触Ajax的第一个实验Hello Word

<html>
<head>
<title>new ajax</title>
<mce:style type="text/css"><!--
body{
margin-top:50px;
}
.MyDiv{
font-size:12px;
border:1px solid #DDD;
background-color:#FFD;
margin:2px;
width:200px;
}

--></mce:style><style type="text/css" mce_bogus="1"> body{
margin-top:50px;
}
.MyDiv{
font-size:12px;
border:1px solid #DDD;
background-color:#FFD;
margin:2px;
width:200px;
}
</style>
</head>
<body onload="getResponse()">
<mce:script language="javascript"><!--
var xmlhttp;
//通过一下的方式确保在不通的浏览器中都能够声明XMLHttpRequest对象.
try{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttp=new ActiveXObject("Microsoft.XHLHTTP");
}catch(e){
try{
xmlhttp=new XMLHttpRequest();
}catch(e){}
}
}
function getResponse(){
//构造函数URL,传送一个本地时间。
var dateObj=new Date();
var url="Response.php?time="+dateObj.toLocaleString();
xmlhttp.open("GET",url);
//绑定showMessage方法到onreadystatechange事件。
xmlhttp.onreadystatechange=showMessage;
//绑定之后调用send方法,有时颠倒这个次序会使响应得不到处理。
xmlhttp.send();
}
function showMessage(){
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
document.getElementById("Result").innerHTML=xmlhttp.responseText;
}
else{
document.getElementById("Result").innerHTML="Error!";
}
}
}
// --></mce:script>
<center>
<div id="Result" class="MyDiv" >Information:</div>
<input type="button" value="Get response" onclick="getResponse()">
</center>
</body>
</html>
服务器端响应文件Respons.php
<?
//回传客户端时间、Hello Word以及服务器时间一同返回客户端
echo "Ajax Test"."<br/>";
echo "myTime:".$_GET["time"]."<br/>";
echo "server:Hello Word!<br/>";
echo "server Time:".$showtime=date("Y-m-d H:i:s");
?>  


相关文档:

将jQuery应用于Asp.net Ajax时,应避免的3个错误

3 mistakes to avoid when using jQuery with ASP.NET AJAX
AJAX, ASP.NET, JavaScript, jQuery By Dave Ward on June 5th, 2008
Over the past few weeks, I think I have definitely embodied Jeff Atwood’s claim that we’re all amateurs, learning together. Despite my best efforts to thoroughly tes ......

增强AJAX/Javascript/JS网页文字抓取能力


本文是对《AJAX动态网页信息提取原理》
的补充,前文总结了两种AJAX网页文字的抓取方法:
网页文字在加载HTML文档(document)的时候用Javascript代码获取和展现,此Javascript代码在发送load事件之前运行,那么接收到load事件表示所有的内容都加载完了
网页文字在加载完HTML文档(document)后在某个时刻用Javascript ......

AJAX控件2

AJAX控件2
17. MutuallyExclusiveCheckBox
【功能概述】
互斥复选框就像RadioButton一样,应用的场景是:“a number of choices are available but only one can be chosen”
【细节】
(1)Key属性用来分组就像RdiolistGroup一样
(2)argetControlID用来绑定已有的CheckBox
【代码示意】
<ajaxToolkit:M ......

ajax创建XMLHttpRequest对象

function ajaxFunction()
{
var xmlHttp;

try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
......

ASP.NET Ajax中Sys未定义错误解决方案

在web.config中修改修改属性
1:<configSections><configSections>中加下面代码
 <configSections>
  <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号