| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1335 人关注过本帖
标题:请高手帮我看下为什么,检测姓名,电话是否为空这段程序不运行
只看楼主 加入收藏
ac923
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-12-3
收藏
 问题点数:0 回复次数:2 
请高手帮我看下为什么,检测姓名,电话是否为空这段程序不运行
<script language="JavaScript" type="text/JavaScript">
var xmlHttp = false;
if (window.ActiveXObject) {
   xmlHttp = new ActiveXObject("MsXml2.XmlHttp");
   } else {
xmlHttp = new XMLHttpRequest();
}
if(!xmlHttp){alert("呵呵,你的系统不支持")}
function CheckUser()
 {
   var url = "act.asp?mydo=CheckUser&WUserId="+document.xp.WUserId.value
        xmlHttp.open("GET", url, true);
        xmlHttp.onreadystatechange = CheckPage; //可以直接调用 CheckPage() 函数
        xmlHttp.send(null);
 }

function CheckPage() {
if (xmlHttp.readyState == 0) { text2.innerHTML= "正在查询数据";}
if (xmlHttp.readyState == 1) { text2.innerHTML= "正在初始化数据";}
if (xmlHttp.readyState == 2) { text2.innerHTML= "正在发送数据";}
if (xmlHttp.readyState == 3) { text2.innerHTML= "数据传送中";}
if (xmlHttp.readyState == 4) //4为准备完毕
 {
   var CheckResult=xmlHttp.responseText; //得到处理页面的数据
   text2.innerHTML= CheckResult;
 }
}


function checpwd()
{ with(document.all)
{if(input1.value!=input2.value)
{alert("两次密码不同")
input1.value = "";
input2.value = "";
return false;
}
}
}

</script>

<script language="javascript">
<!--

function Chkform()
{
if(document.all.wMINZI".value=='')
{
    alert('姓名不许为空')
    document.xp.wMINZI".focus;
    return false;
}
if(document.xp.WSex.value=='')
{
    alert('请选择性别')
    document.xp.WSex.focus;
    return false;
}
if(document.xp.WShenfz.value=='')
{
    alert('身份证不许为空')
    document.xp.WShenfz.focus;
    return false;
}
if(document.xp.WDianHua.value=='')
{
    alert('联系方式不许为空')
    document.xp.WDianHua.focus;
    return false;
}
if(document.xp.Wpingpai.value=='')
{
    alert('车品牌不许为空')
    document.xp.Wpingpai.focus;
    return false;
}
return false;
}
//-->
</script>



<html><head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css.css" rel="stylesheet" type="text/css">

</script>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
.STYLE1 {
    font-size: 12px;
    line-height: 20px;
    color: #000000;
}
body,td,th {
    font-size: 12px;
    color: #000000;
}
a {
    font-size: 12px;
    color: #000000;
}
a:link {
    text-decoration: none;
}
a:visited {
    text-decoration: none;
    color: #000000;
}
a:hover {
    text-decoration: underline;
    color: #000099;
}
a:active {
    text-decoration: none;
    color: #000099;
}
.STYLE6 {color: #FF0000}
.STYLE7 {color: #000000}
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<!--#include file="top.asp"-->
<table width="1005" height="91" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="136" background="images/index_09.gif">&nbsp;</td>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <!--#Include File="false.asp"-->
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="171"><img src="images/index_16.gif" width="170" height="34" alt=""></td>
              <td width="130"><img src="images/index_172.gif" width="130" height="34" alt=""></td>
              <td width="332" background="images/index_18.gif">&nbsp;</td>
              <td width="110" background="images/index_18.gif">&nbsp;</td>
            </tr>
            <tr>
              <!--#Include File="zxgg.asp"-->
              <td colspan="3" rowspan="4" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="491" valign="top"><br>
                        <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                          <tr>
                            <td align="center">车主注册
                              <label> </label>
                                <table width="508" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td width="862" align="center" valign="top"><form method="POST" name="xp" action="regsave.asp">
                                        <table width="480" border="0" cellspacing="0" cellpadding="0">
                                          <tr>
                                            <td height="34" background="images/index_18.gif"><img src="images/index_172.gif" width="130" height="34" /></td>
                                          </tr>
                                        </table>
                                      <table width="480" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
                                          <tr align="center" valign="top">
                                            <td height="351" class="tdbg"><table width="100%" border="0" align="right" cellpadding="2" cellspacing="1" class="table_southidc">
                                                <tr>
                                                  <td width="77" height="4" align="right" bgcolor="#B6D52F">设置用户名:</td>
                                                  <td width="137" bgcolor="#E3E3E3"><input name="WUserId" type="text" onBlur="CheckUser()" size="10" maxlength="20">
                                                  <span class="STYLE6">*</span> </td>
                                                  <td colspan="3" bordercolor="#FFFFFF" bgcolor="#CCCCCC"><label> </label>
                                                      <div align="center" class="STYLE6" id="text2">                                                        </div>                                                    </td>
                                                </tr>
                                                <tr>
                                                  <td width="77" height="5" align="right" bgcolor="#B6D52F">设置密码:</td>
                                                  <td colspan="2" bgcolor="#E3E3E3"><input name="WUSERPWD" type="text" size="10" maxlength="20" id="input1">
                                                  <span class="STYLE6">*</span></td>
                                                  <td width="78" align="right" bgcolor="#B6D52F">确认密码</td>
                                                  <td width="163" bgcolor="#E3E3E3"><input name="WUSERPWD" type="text" size="10" maxlength="20" id="input2" onBlur="checpwd()">
                                                  <span class="STYLE6">*</span></td>
                                                </tr>
                                                <tr>
                                                  <td width="77" height="11" align="right" bgcolor="#B6D52F">姓名:</td>
                                                  <td colspan="2" bgcolor="#E3E3E3"><input name="wMINZI" type="text" size="10" maxlength="20">
                                                      <span class="STYLE6">*</span></td>
                                                  <td width="78" align="right" bgcolor="#B6D52F">性别:</td>
                                                  <td bgcolor="#E3E3E3"><select name="WSex">
                                                      <option value="">请选择</option>
                                                      <option value="1">男</option>
                                                      <option value="0">女</option>
                                                    </select>
                                                      <span class="STYLE6">*</span></td>
                                                </tr>
                                                <tr>
                                                  <td width="77" height="22" align="right" bgcolor="#B6D52F">年龄:</td>
                                                  <td colspan="2" bgcolor="#E3E3E3"><input name="Wnianlin" type="text" size="10" maxlength="10"></td>
                                                  <td align="right" bgcolor="#B6D52F">职业:</td>
                                                  <td bgcolor="#E3E3E3"><input name="Wzhiye" type="text" size="10" maxlength="12"></td>
                                                </tr>
                                                <tr>
                                                  <td height="22" align="right" bgcolor="#B6D52F"><p>身份证:</p></td>
                                                  <td colspan="4" bgcolor="#E3E3E3"><input name="WShenfz" type="text" size="20" maxlength="18">
                                                    &nbsp;<span class="STYLE6">*</span></td>
                                                </tr>
                                                <tr>
                                                  <td height="22" align="right" bgcolor="#B6D52F">联系方式1:</td>
                                                  <td colspan="2" bgcolor="#E3E3E3"><input name="WDianHua1" type="text" size="15" maxlength="15">
                                                  <span class="STYLE6">*</span></td>
                                                  <td bgcolor="#B6D52F"><div align="right">联系方式1:</div></td>
                                                  <td bgcolor="#E3E3E3"><span class="STYLE6">
                                                    <input name="WDianHua2" type="text" size="15" maxlength="15">
                                                  </span></td>
                                                </tr>
                                                <tr>
                                                  <td width="77" height="22" align="right" valign="middle" bgcolor="#B6D52F">邮箱:</td>
                                                  <td colspan="4" bgcolor="#E3E3E3"><input name="WEmaiL" type="text" size="15" maxlength="20">
                                                      <select tabindex="2" size="1" name="lEnd">
                                                        <option value="">请选择信箱</option>
                                                        <option value=" 网易</option>
                                                        <option value=" 新浪</option>
                                                        <option value=" 网易</option>
                                                        <option value="cn. 雅虎</option>
                                                        <option value="
                                                        <option value="
                                                        <option value=" 搜狐</option>
                                                        <option value="
                                                        <option value="vip.
                                                        <option value="
                                                        <option value="vip.新浪VIP</option>
                                                        <option value="mail.
                                                        <option value="
                                                        <option value="
                                                        <option value="
                                                        <option value=" 亿唐</option>
                                                        <option value="新华网</option>
                                                        <option value=" 亿邮</option>
                                                        <option value=" 上海热线</option>
                                                        <option value="
                                                        <option value="
                                                        <option value="
                                                      </select>
                                                    &nbsp;</td>
                                                </tr>
                                                <tr>
                                                  <td height="22" align="right" bgcolor="#B6D52F">联系地址:</td>
                                                  <td height="22" colspan="4" bgcolor="#E3E3E3"><input name="Wlianxidizhi" type="text" size="32" maxlength="32"></td>
                                                </tr>
                                                <tr>
                                                  <td height="22" align="right" bgcolor="#B6D52F">详细说明:</td>
                                                  <td height="22" colspan="4" bgcolor="#E3E3E3"><textarea name="Wshuoming" cols="30" rows="4"></textarea></td>
                                                </tr>
                                                <tr>
                                                  <td height="22" align="right" bgcolor="#B6D52F">品牌:</td>
                                                  <td height="22" colspan="2" bgcolor="#E3E3E3"><input name="Wpingpai" type="text"  size="15" maxlength="50">
                                                    &nbsp;<span class="STYLE6">*</span></td>
                                                  <td height="22" align="right" bgcolor="#B6D52F">车载人数:</td>
                                                  <td height="22" bgcolor="#E3E3E3"><input name="WRenShu" type="text" size="4" maxlength="4" />
                                                    &nbsp;<span class="STYLE6">人</span>&nbsp;<span class="STYLE6">*必须为数字</span></td>
                                                </tr>
                                                <tr>
                                                  <td height="22" align="right" bgcolor="#B6D52F">车型:</td>
                                                  <td height="22" colspan="2" bgcolor="#E3E3E3"><input name="WCheXing" type="text"  size="10" maxlength="20"></td>
                                                  <td height="22" align="right" bgcolor="#B6D52F">车号:</td>
                                                  <td height="22" bgcolor="#E3E3E3"><input name="WCheHao" type="text" size="10" maxlength="20" /></td>
                                                </tr>
                                                <tr>
                                                  <td height="22" align="right" bgcolor="#B6D52F">车况:</td>
                                                  <td height="22" colspan="2" bgcolor="#E3E3E3"><input name="WCheKuang" type="text" size="10" maxlength="20" /></td>
                                                  <td height="22" align="right" bgcolor="#B6D52F">颜色:</td>
                                                  <td height="22" bgcolor="#E3E3E3"><input name="Wyanse" type="text" size="10" maxlength="20" /></td>
                                                </tr>
                                            </table></td>
                                          </tr>
                                        </table>
                                      <div id="text" align="center">
                                          <input name="Addd" type="submit" value=" 提 交 " onClick="return Chkform()">
                                        </div>
                                    </form></td>
                                  </tr>
                              </table></td>
                          </tr>
                      </table></td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td height="22"><img src="images/index_30.gif" width="170" height="22" alt=""></td>
            </tr>
            <tr>
              <td height="285" valign="top" background="images/index_31.gif"><!--#Include File="sx.asp"--></td>
            </tr>
            <tr>
              <td height="21"><img src="images/index_39.gif" width="170" height="21" alt=""></td>
            </tr>
        </table></td>
      </tr>
      <tr>
      
      </tr>
    </table></td>
    <td width="126" background="images/index_12.gif">&nbsp;</td>
  </tr>
</table>
<!--#include file="foot.asp"-->
</body>
</html>
搜索更多相关主题的帖子: 姓名 检测 电话 
2008-12-03 17:11
zplove
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:783
专家分:0
注 册:2006-7-30
收藏
得分:0 
document.all.wMINZI

不要用这个,用document.getElementById("")

相信自己的没错了
2008-12-11 11:31
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
收藏
得分:0 
if(document.all.wMINZI".value=='')
{
    alert('姓名不许为空')
    document.xp.wMINZI".focus;
    return false;
}
你这里是不是多了两个双引号啊??

飘过~~
2008-12-11 13:18
快速回复:请高手帮我看下为什么,检测姓名,电话是否为空这段程序不运行
数据加载中...
 
   



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

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022234 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved