<script language="javascript">
<!--
function ajaxSubmit(){
var xmlHttp;
try{
xmlHttp = new XMLHttpRequest();
}
catch(e){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
//創建請求處理結果程序
xmlHttp.onreadyStatechange = function(){
if(4 == xmlHttp.readyState){
if(200 == xmlHttp.Status){
var str = xmlHttp.responseText;
alert("成功");
}
else{
alert("失敗");
}
}
}
xmlHttp.open("post","ajax.aspx",true);
//post時才設的HTTP頭
xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xmlHttp.send("title="+escape(title));
}
/*************二**************************/
var xmlHttp;
function GetXmlHttp(handler){
var objXmlHttp;
try{
xmlHttp = new XMLHttpRequest();
}
catch(e){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
objXmlHttp.onreadystateChange = handler;
return objXmlHttp;
}
function stateChange(){
if(4 == xmlHttp.readyState){
if(200 == xmlHttp.Status){
var str = xmlHttp.responseText;
alert("成功");
document.getElementById("a").innerHTML = xmlHttp.responseText;
}
else{
alert("失敗");
}
}
}
function showHint(str){
if(str.Length > 0){
xmlHttp = GetXmlHttp(stateChange);
xmlHtp.open("Get","register.aspx",true);
xmlHttp.send(null);
}
else{
document.getElementById("a").innerHTML = "";
}
}
//-->
</script>