学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
轻松建立自己的群组,招兵买马   
发新话题
打印

哪位师傅看看问题出在哪谢谢!

本主题由 lmhllr 于 2008-7-21 01:13 审核通过

哪位师傅看看问题出在哪谢谢!

当student和pwd文本框为空时不显示alert中的内容




<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE6 {
    font-size: 36px;
    font-style: italic;
    color: #FF0000;
}
-->
</style>
<script language="javascript">
function check()
{
  if(document.form1.student.value=="")
   {alert("请输入用户名");
    document.form1.student.focus();
    return false;}
  if(docuemnt.form1.pwd.value=="")
   {alert("请输入用户密码");
   document.form1.pwd.focus();
   return false;}
   document.form1.ctype.value="add";
   document.form1.submit();
   }</script>
</head>

<body>
<table align="center" width="758" height="152" border="0">
<tr>
  <td width="736" height="100%" bgcolor="#33FF33"><div align="center" class="STYLE6">在线考试系统 </div></td>
  </tr>
</table>

<table  width="734" border="0" align="center" cellpadding="4" bordercolor="#1111111" style="border-collapse:collapse; position:absolute; left: 258px; top: 182px;">
  <tr>
    <td height="249"><form id="form1" name="form1" method="post" action="">
    <input type="hidden" name="ctype"  />
      <table width="745" border="0" height="247">
        <tr>
          <td width="8"> </td>
          <td width="359"><table width="100%" border="0" style="border-collapse:collapse" bordercolor="#111111" cellpadding="5" cellspacing="0"  >
            <tr>
              <td width="21%"><div align="center">用户名</div></td>
              <td colspan="2"><label>
                <input type="text" name="student" />
              </label></td>
              <td width="18%"> </td>
            </tr>
            <tr>
              <td><div align="center">密码</div></td>
              <td colspan="2"><label>
                <input type="text" name="pwd" />
              </label></td>
              <td> </td>
            </tr>
            <tr>
              <td> </td>
              <td width="23%"><label>
                <input type="button" onclick="check()" name="Submit" value="提交" >
              </label></td>
              <td width="38%"><label>
                <input type="submit" name="Submit2" value="重置" />
              </label></td>
              <td> </td>
            </tr>
            <tr>
              <td> </td>
              <td colspan="2"><a href="register.asp" >新学生注册</a></td>
              <td> </td>
            </tr>
            <tr>
              <td> </td>
              <td colspan="2"><p><a href="admin/index.asp">后台管理程序入</a></p>                </td>
              <td> </td>
            </tr>
          </table>
            <p> </p></td>
          <td width="356"><p> </p>
            <p align="center"><img src="gif/晚霞.jpg" width="139" height="104" /></p></td>
        </tr>
      </table>
        </form>
    </td>
  </tr>
</table>



</body>
</html>

TOP

if(docuemnt.form1.pwd.value=="")   -->  if(document.form1.pwd.value=="")
alert("请输入用户密码");         -->  alert("请输入用户密码");//右括号和分号不对
编海无涯,回头死岸

TOP

发新话题