日期:2014-05-19  浏览次数:20851 次

请教AJAX后台代码C#的
我的前台代码已经写好了是一个严整码的程序,请高手指教下小弟跪谢.
我的前台是:
<html>
<head>
<title> </title>
<meta   name= "GENERATOR "   content= "Microsoft   Visual   Studio   .NET   7.1 ">
<meta   name=ProgId   content=VisualStudio.HTML>
<meta   name=Originator   content= "Microsoft   Visual   Studio   .NET   7.1 ">
<script   language=javascript>
var   xmlhttp;
function   createXMLHttpRequest()
{
if(window.XMLHttpRequest)
{
xmlhttp=new   XMLHttpRequest();
}
if(window.ActiveXObject)
{
xmlhttp=new   ActiveXObject( "Microsoft.XMLHTTP ");
}
}
function   validate()
{
createXMLHttpRequest();
var   date=document.getElementById( "birthDate ");
var   url= "ValidationServlet.aspx?birthDate= "+eacape(date.value);
xmlhttp.open( "GET ",url,true);
xmlhttp.onreadystatechange=callback;
xmlhttp.open(null);
}
function   callback()
{
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200   ||   xmlhttp.status==200)
{
var   mes=xmlhttp.responseXML.getElementsByTagName( "message ")[0].firstChild.data;
var   val=xmlhttp.responseXML.getElementsByTagName( "passed ")[0].firstChild.data;
setMessage(mes,val);
}
}
}
function   setMessage(message,isValid)
{
var   messageArea=document.getElementById( "dateMessage ");
var   fontColor= "red ";
if(isValid== "true ")
{
fontColor= "green ";
}
messageArea.innerHTML= " <font   Color= "+fontColor+ "> "+message+ " </font> ";
}
</script>
</head>
<body>
<h1> AJAX   Validation   Example </h1>
Birth   date: <input   type=text   size=10   id=birthDate   onchange=validate()>
<div   id= "dateMessage "> </div>
</body>
</html>

------解决方案--------------------
不是有现成的框架么,何必呢