| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 2035 人关注过本帖
标题:请高手帮帮忙,在线等
取消只看楼主 加入收藏
vcwindow
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2008-4-22
收藏
 问题点数:0 回复次数:1 
请高手帮帮忙,在线等
<script   language="javascript">   
      function   checkName(NameStr)   
      {   
            if(NameStr.replace(/\s/g,"")=="")   
            {   
                      document.form1.type.focus();   
                      alert("用户名不能为空!");   
            }   
            else   
            {   
    var xmlhttp =new ActiveXObject ("Microsoft.XMLHTTP");  
    xmlhttp.open("post","test.asp?uName="+NameStr,false);   
    xmlhttp.setrequestheader("contrn-type","text/xml");  
    xmlhttp.setrequestheader("contrn-charset","gb2312");  
xmlhttp.send();
    if(xmlhttp.responseText==0)  {
    alert("已经存在相同的用户名");   
      }
else{  
    alert("对不起,你不能使用");  
  }
     }   
      }   
  </script><input name="button" type="button" class="button" value="检测" onClick="checkName(document.form1.type.value)" ></td>




test.asp
<!--#include file="conn.asp" -->
<%   
dim   strNewName   
  strNewName=request("uName")   
  set rs=server.createobject("adodb.recordset")   
  sql="select * from   book  where  type='"&strNewName&"'"   
  rs.open  sql,conn,1,3  
  if  not(rs.eof and rs.bof)  then
  a1=rs("name")   
   response.write 0  
  else   
   response.write 1  

  end if   
  rs.close  
  set rs=nothing  
  %>   
     

  程序运行后,无论该名称是否存在,都会提示“对不起,你不能使用”这一行
2008-04-22 18:30
vcwindow
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2008-4-22
收藏
得分:0 
按楼主所说,改了一下,提示“对象不支持此属性”,再次郁闷中。。。。

这行:if(xmlhttp.getHttpRequest().readyState==4)
2008-04-24 14:48
快速回复:请高手帮帮忙,在线等
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025326 second(s), 10 queries.
Copyright©2004-2025, BC-CN.NET, All Rights Reserved