CNET中国旗舰网站

ZDNet China | CNET科技资讯网 | 政府采购 | 行业网站联盟





 
标题: [求助] 一个简单的ajax用户登陆返回值问题?有代码
小玩将
支柱会员
Rank: 10Rank: 10Rank: 10



UID 319552
精华 3
积分 16584
帖子 1526
威望 7556
ZD币 2005 元
阅读权限 210
注册 2008-4-16
状态 离线
  楼主
发表于 2008-4-17 14:55  资料  个人空间  短消息  加为好友 
开发者在线

一个简单的ajax用户登陆返回值问题?有代码

————aaa.asp   文件————————————     
  <html   xmlns="http://www.w3.org/1999/xhtml">     
  <head>     
  <title>Using   responseText   with   innerHTML</title>     
  <meta   charset="gb2313">     
  <script   type="text/javascript">     
  var   xmlHttp;     
  function   createXMLHttpRequest()   {     
  if   (window.ActiveXObject)   {     
  xmlHttp   =   new   ActiveXObject("Microsoft.XMLHTTP");     
  }     
  else   if   (window.XMLHttpRequest)   {     
  xmlHttp   =   new   XMLHttpRequest();     
  }     
  }     
  function   startRequest()   {     
  createXMLHttpRequest();     
  xmlHttp.onreadystatechange   =   handleStateChange;     
  //xmlHttp.open("post",   "bb.html",   true);     
  xmlHttp.open("POST",   'bbb.asp?name='+document.getElementById("name").value   +   "&pwd="   +   document.getElementById("pwd").value,   true);     
  //xmlHttp.open("POST",   "bbb.asp",   true);     
  xmlHttp.send(null);     
  }     
   
  function   handleStateChange()   {     
  if(xmlHttp.readyState   ==   4)   {     
  if(xmlHttp.status   ==   200)   {     
  document.getElementById("results").innerHTML   =   xmlHttp.responseText;     
  }     
  }     
  }     
  </script>     
  </head>     
  <body>     
  <p>姓名:<input   type="text"   name="name"   size="20"></p>     
  <p>密码:<input   type="password"   name="pwd"   size="20"></p>     
  <!--webbot   bot="SaveResults"   U-File="fpweb:///_private/form_results.csv"   S-Format="TEXT/CSV"   S-Label-Fields="TRUE"   -->     
  <p><input   type="button"   value="确定"   name="B3"   ></p>     
  <div   id="results"></div>     
  </body>     
  </html>     
   
  -----bbb.asp------     
  <%     
  name   =   request("name")     
  pwd   =   request("pwd")     
  response.write   "your   name   is   "   &   name     
  response.write   "<br/>your   password   is   "   &   pwd     
  %>   
   
   
  我现在要用alert()弹出返回回来的值   ,我是这么写的   
  把document.getElementById("results").innerHTML   =   xmlHttp.responseText;     
  换成了   
  alert(   xmlHttp.responseText);   
  可是弹出来的有很多的标签信息   
  我只想要弹出值   ,请问该怎么作,谢谢




顶部
热点频道推荐: C/S开发| 数据库| WEB开发| 嵌入式| 项目管理|
 



当前时区 GMT+8, 现在时间是 2009-7-5 09:31

  Powered by Discuz! 5.5.0 © 2001-2007 Comsenz Inc.
Processed in 0.076304 second(s), 3/3 queries

清除 Cookies - 联系我们 - ZDNetChina中文社区 - 无图版