| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 869 人关注过本帖
标题:各位高手看看我这个代码哪里有问题?怎么改,谢谢……
取消只看楼主 加入收藏
爱孔孟
Rank: 2
等 级:论坛游民
帖 子:5
专家分:10
注 册:2010-5-31
收藏
 问题点数:0 回复次数:0 
各位高手看看我这个代码哪里有问题?怎么改,谢谢……
<%@ page language="java" import="java.util.*" pageEncoding="utf-8" contentType="text/html"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>登录界面</title>
   
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

  </head>
  <script language="JavaScript">
function Validate()
{
//得到用户 输入的信息  
userid=form.userid.value;
userpass=form.userpass.value;
//判断用户名的长度
    if(!maxLength(userid,12))
        {
        alert("拥护名长度大于12!");
        form.userid.focuse();
        return false;
        }
   
    if(!maxLength(userpass,12))
        {
        alert("密码长度大于12!");
        form.userpass.focuse();
        return false;
        }
   
    //判断拥护名和密码是否一致
    if(userid==userpass)
        {
        alert("拥护名和密码不能相同");
        form.userpass.focuse();
        return false;
        }
return true;
}
//验证是否满足最小长度
function minLength(str,length)
    {
    if(str.length>=length)
        return true;
    else
         return false;     
    }
function maxLength(str,length)
    {
    if(str.length<=length)
        return true;
    else
         return false;     
    }
   
      window.open("http://www.baidu.com","window2")
      
</script>
  <body>
 <form action="MyJsp2.jsp" onsubmit="return Validate();" method="post">
 用户名:<input type="text" name="userid"><br>
 密码:<input type="password" name="userpass"><br>
 <input type="reset" value="重填" >
  <input type="submit" value="确定">
</form>
  </body>
</html>
搜索更多相关主题的帖子: 代码 
2010-11-25 17:21
快速回复:各位高手看看我这个代码哪里有问题?怎么改,谢谢……
数据加载中...
 
   



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

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