| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1343 人关注过本帖
标题:登录首页 弹框提示 写了没出效果,请问怎么改,谢谢
取消只看楼主 加入收藏
sunpei
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2011-11-28
收藏
 问题点数:0 回复次数:2 
登录首页 弹框提示 写了没出效果,请问怎么改,谢谢
要提示用户名或密码不能为空,请问要怎么改
我这写了但没出效果



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<form action=".jsp" method="post"onsubmit="return checkform()"name="form1">
<HEAD>

<TITLE>无标题页</TITLE>

<META http-equiv=Content-Type content="text/html; charset=gbk">

<LINK

href="images/public.css" type=text/css rel=stylesheet>

<LINK

href="images/login.css" type=text/css rel=stylesheet>

<STYLE type=text/css>

</STYLE>
<script language="javascript">
function checkform()
{
if(form11.username.value==""){
alert("用户名不能为空。");
form1.username.focus();
return false;
}
if(form1.username.value.length<1‖form1.username.value.length>20){
alert("用户名超出了范围(1~20).");
form1.username.focus();
return false;
}
if(form1.password.value==""){
alertt("密码不能为空。");
form1.password.focus();
return false;
}
if(form1.password.value.length<1‖form1.password.value.length>20){
alert("密码超出了范围(1~20).");
form1.password.focus();
return false;
}
}
</script>
<META content="MSHTML 6.00.2900.5848" name=GENERATOR>

</HEAD>

<BODY>

<DIV id=div1>

  <TABLE id=login height="100%" cellSpacing=0 cellPadding=0 width=800

align=center>

    <TBODY>

      <TR id=main>

        <TD>

          <TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%">

            <TBODY>

              <TR>

                <TD colSpan=4>&nbsp;</TD>

              </TR>

              <TR height=30>

                <TD width=380>&nbsp;</TD>

                <TD>&nbsp;</TD>

                <TD>&nbsp;</TD>

                <TD>&nbsp;</TD>

              </TR>

              <TR height=40>

                <TD rowSpan=4>&nbsp;</TD>

                <TD>用户名:</TD>

                <TD>

                  <INPUT class=textbox id=username name=username>

                </TD>

                <TD width=120>&nbsp;</TD>

              </TR>

              <TR height=40>

                <TD>密 码:</TD>

                <TD>

                  <INPUT class=textbox id=password type=password

            name=password>

                </TD>

                <TD width=120>&nbsp;</TD>

              </TR>

              <TR height=40>

                <TD><br></TD>

                <TD vAlign=center colSpan=2><br></TD>

              </TR>

              <TR height=40>

                <TD></TD>

                <TD align=right>

                  <INPUT id=btnLogin type=submit value=" 登 录 " name=btnLogin onclick="javascript:return(checkform());">

                </TD>

                <TD width=120>&nbsp;</TD>

              </TR>

              <TR height=110>

                <TD colSpan=4>&nbsp;</TD>

              </TR>

            </TBODY>

          </TABLE>

        </TD>

      </TR>

      <TR id=root height=104>

        <TD>&nbsp;</TD>

      </TR>

    </TBODY>

  </TABLE>

</DIV>

<DIV id=div2 style="DISPLAY: none"></DIV>

</CONTENTTEMPLATE>
</form>
</BODY>

</HTML>
搜索更多相关主题的帖子: return 用户名 PUBLIC content 密码 
2011-12-08 10:24
sunpei
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2011-11-28
收藏
得分:0 
不弹框的也可以,有些直接在输入用户名和密码的框后面,输出“用户名和密码不能为空”的文字
2011-12-08 10:26
sunpei
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2011-11-28
收藏
得分:0 
我改了成这样行了


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE>无标题页</TITLE>

<META http-equiv=Content-Type content="text/html; charset=gbk">

<LINK

href="images/public.css" type=text/css rel=stylesheet>

<LINK

href="images/login.css" type=text/css rel=stylesheet>

<STYLE type=text/css>

</STYLE>

<script>
function checkform(){
var form1 = document.form1;
if(form1.username.value.length<1 || form1.username.value.length>20){
alert("用户名超出了范围(1~20).");
form1.username.focus();
return false;
}
if(form1.password.value.length<1 || form1.password.value.length>20){
alert("密码超出了范围(1~20).");
form1.password.focus();
return false;
}
}
</script>
<META content="MSHTML 6.00.2900.5848" name=GENERATOR>

</HEAD>

<BODY>
<form name="form1" id="form1"action="check.jsp">
<DIV id=div1>

  <TABLE id=login height="100%" cellSpacing=0 cellPadding=0 width=800

align=center>

    <TBODY>

      <TR id=main>

        <TD>

          <TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%">

            <TBODY>

              <TR>

                <TD colSpan=4> </TD>

              </TR>

              <TR height=30>

                <TD width=380> </TD>

                <TD> </TD>

                <TD> </TD>

                <TD> </TD>

              </TR>

              <TR height=40>

                <TD rowSpan=4> </TD>

                <TD>用户名:</TD>

                <TD>

                  <INPUT class=textbox id=username name=username>

                </TD>

                <TD width=120> </TD>

              </TR>

              <TR height=40>

                <TD>密 码:</TD>

                <TD>

                  <INPUT class=textbox id=password type=password

            name=password>

                </TD>

                <TD width=120> </TD>

              </TR>

              <TR height=40>

                <TD><br></TD>

                <TD vAlign=center colSpan=2><br></TD>

              </TR>

              <TR height=40>

                <TD></TD>

                <TD align=right>

                  <INPUT id=btnLogin type=submit value=" 登 录 " name=btnLogin onclick="return checkform()">

                </TD>

                <TD width=120> </TD>

              </TR>

              <TR height=110>

                <TD colSpan=4> </TD>

              </TR>

            </TBODY>

          </TABLE>

        </TD>

      </TR>

      <TR id=root height=104>

        <TD> </TD>

      </TR>

    </TBODY>

  </TABLE>

</DIV>

<DIV id=div2 style="DISPLAY: none"></DIV>

</CONTENTTEMPLATE>
</form>
</BODY>

</HTML>
2011-12-08 20:42
快速回复:登录首页 弹框提示 写了没出效果,请问怎么改,谢谢
数据加载中...
 
   



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

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