创建ajax中的xmlhttprequest对象
<html>
<body>
<script type="text/javascript">
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
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("您的浏览器不支持AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open("GET","time.asp",true);
xmlHttp.send(null);
}
</script>
<form name="myForm">
用户: <input type="text" name="username" onkeyup="ajaxFunction();" />
时间: <input type="text" name="time" />
</form>
</body>
</html>
相关文档:
function saveObj(){
var userName = document.getElementById("userName").value;
checkUserName(userName);
}
//使用ajax实现页面无刷新功能;
var xmlHttpRequest;
function createXMLHttpRequest(){
if(windo ......
许多程序员在做业务开发时往往会在服务器端做用户信息的验证,有没有考虑过用jquery的ajax方法来验证登陆呢?且效果比在服务器端写代码来验证好的多,页面无刷新即可实现实现登陆验证,代码也简单。
现在下面贴出来的是很简单的用jquery的ajax方法来验证登陆的代码,适合刚接触jquery的朋友学习。
前台页面代码:
<he ......
原来用jQuery的ajax方式调用asp.net页面基本都是调用单个页面,由调用页面Response内容,而现在采用asp.net ajax后,我们则可以更完美的使用jQuery和asp.net结合了,代码如下:
<asp:ScriptManager ID="ScriptManager1" runat="server" >
<Scripts>
<asp:ScriptReference Path="http ......
AJAX自从引进了Tab,着实让我开心了一番。但是,在调整Tab的样式的时候,也着实让我吃了一惊。
于是,抱着没有困难也要制造困难的原则,开始了征途:
按照Tab作者Ronald Buckton所说,Tab的CSS包含如下几个类:
(1).ajax__tab_header: A container element that wraps all of the tabs at the top of the TabContainer.
......
在C#中
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
using System.Collections;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.Ba ......