日期:2014-05-18  浏览次数:20626 次

请热心人士帮忙找找错
请热心人士帮忙找找错,从ftp   从getAndPostExample.htm获取要上传文件的路径.
getAndPostExample.htm

<html>
<head> <title> sending   request   data   using   get   and   post </title>
<script   type= "text/javascript ">
var   xmlHttp;
function   createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp=new   ActiveXObject( "Microsoft.XMLHTTP ");
//xmlHttp.validateOnParse=false;

}
else   if(window.XMLHttpRequest){
xmlHttp=new   XMLHttpRequest();
}
}
function   createQueryString(){
var   firstName=document.getElementById( "lujing ").value;

var   queryString= "firstName= "   +   firstName;
//var   queryString= "Hello ";
return   queryString;
}
function   doRequestUsingGET(){
//firstname.value "hehehhe ";
createXMLHttpRequest();
var   queryString= "ftp? ";
queryString=queryString   +   createQueryString()   +   "&timeStamp= "   +   new   Date().getTime();
//Text2.value=queryString;
xmlHttp.onreadystatechange=handleStateChange;
xmlHttp.open( "GET ",queryString,   true);
xmlHttp.send(null);
}
function   doRequestUsingPOST(){
createXMLHttpRequest();
var   url= "ftp?timeStamp= "   +   new   Date().getTime();
var   queryString=createQueryString();
xmlHttp.open( "POST ",url,true);
xmlHttp.onreadystatechange=handleStateChange;
xmlHttp.setRequestHeader( "Content-Type ", "application/x-www-form-urlencoded; ");
xmlHttp.send(queryString);
}

function   handleStateChange(){
  //if(xmlHttp.readyState==4){
  //Text1.value=xmlHttp.status;
      //   if(xmlHttp.status==200){
      parseResults();
      Text2.value=xmlHttp.readState+ "and "+xmlHttp.status;
      //   }
  //}
}
function   parseResults(){
var   responseDiv=document.getElementById( "serverResponse ");
if(responseDiv.hasChildNodes()){
responseDiv.removeChild(responseDiv.childNodes[0]);

}
var   responseText=document.createTextNode(xmlHttp.responseText);
responseDiv.appendChild(responseText);
}


</script>
</head>
<body>
<h1> enter   you   first   name,middle   name,and   birthday; </h1>
<table> <tbody>
<tr>
<td> first   path: </td>
<td> <input   type= "text "   id= "lujing "/> </td>
<td> <input   type= "text "   id= "Text2 "   /> </td>
</tr>


</tbody>
</table>

<form   action= "# ">
<input   type= "button "   value= "send   parameters   using   get "   onclick= "doRequestUsingGET(); "/>
<br/> <br/>
<input   type= "button "   value= "send   parameters   using   post "   onclick= "doRequestUsingPOST(); "/>

</form>
<br/>
<h2> server   response: </h2>
<div   id= "