⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.js

📁 VMWare虚拟机安装及使用教程
💻 JS
字号:
/* mail host ip address */
//var mailHost = "192.168.10.26";
//var mailHost = "mail.softhouse.com.cn";

function trimString(str)
{
    var i,j;

    if (str == "") return "";

    for (i = 0; i < str.length; i++)
        if(str.charAt(i) != ' ') break;

    if(i >= str.length) return "";

    for(j = str.length - 1; j >= 0; j--)
        if (str.charAt(j) != ' ') break;

    return str.substring(i, j+1);
}

/**
 * 功能:判断单个字符是否是数字
 * 参数:cCheck,要进行判断的字符串
 * 返回值:true or false
 * 建立日期:2004-6-1
 * 作者:蔡华锋
 * 最后修改:
 * 修改人:
 */
function isDigit(cCheck) 
{
	return (('0' <= cCheck) && (cCheck <= '9'));
}

/**
 * 功能:判断单个字符是否是字母
 * 参数:cCheck,要进行判断的字符串
 * 返回值:true or false
 * 建立日期:2004-6-1
 * 作者:蔡华锋
 * 最后修改:
 * 修改人:
 */
function isAlpha(cCheck) //判断是否是字母
{
    return ((('a' <= cCheck) && (cCheck <= 'z')) || (('A' <= cCheck) && (cCheck <= 'Z')))
}

/**
 * 功能:判断是否是有效的字符
 * 参数:checkStr,要进行判断的字符串
 * 返回值:true or false
 * 建立日期:2004-6-1
 * 作者:蔡华锋
 * 最后修改:
 * 修改人:
 */
function isValidStr(checkStr)
{
    for (var i = 0; i < checkStr.length; i++)
    {
        cCheck = checkStr.charAt(i);
	    if (!(isDigit(cCheck) || isAlpha(cCheck)|| cCheck=='-' || cCheck=='_'))
		{
	        alert("用户名和密码只能使用字母、数字、-、_,并且不能使用中文");
	        return false;
	    }
   }	  
   return true;	
}

function checkLogin()
{
    username = trimString(document.reg.username.value);
    password = trimString(document.reg.password.value);
 
    if (username == "")
    {
        alert("用户名不能为空!");
		document.reg.username.focus();
		return false;
    }

    if (isValidStr(username) == false)
	{
		document.reg.username.focus();
        document.reg.username.select();
		return false;
	}

	if (password == "")
	{
        alert("密码不能为空!");
	    document.reg.password.focus();
	    return false;
	}

	if (isValidStr(password) == false)
	{
        document.reg.password.focus();
		document.reg.password.select();
		return false;
	}
	 
    return true;
}

//document.write("<form action=\"https://" + mailHost + "/cgi-bin/login\" method=\"post\" name=\"reg\" style=\"padding:0;margin:0\" onsubmit=\"return checkLogin()\" target=\"_blank\">");
document.write("<form action=\"/cgi-bin/login\" method=\"post\" name=\"reg\" style=\"padding:0;margin:0\" onsubmit=\"return checkLogin()\" target=\"_blank\">");
document.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"6C93B0\">");
document.write("<tr>");
document.write("<td height=\"24\" align=\"center\" bgcolor=\"A2C6E9\">");
document.write("<table width=\"90%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
document.write("<tr>");
document.write("<td class=\"t_font\"><img src=\"/images/home_drop03.gif\" align=\"absmiddle\"> ");
document.write(" 用户登录 </td>");
document.write("</tr>");
document.write("</table>");
document.write("</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td height=\"120\" align=\"center\" background=\"/images/login_bg1.gif\" bgcolor=\"#FFFFFF\" style=\"background-repeat:no-repeat; background-position:middle;\"> ");
document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\">");
/*document.write("<tr> ");
document.write("<td align=\"right\">选 择:</td>");
document.write("<td><select name=\"select2\">");
document.write("<option selected>邮箱</option>");
document.write("</select></td>");
document.write("</tr>");*/
document.write("<tr> ");
document.write("<td height=3></td>");
document.write("<td height=3>");
document.write("");
document.write("</td>");
document.write("</tr>");
document.write("<tr> ");
document.write("<td align=\"right\">用户名:</td>");
document.write("<td><input name=\"username\" type=\"text\" size=\"15\" class=\"put_1\"></td>");
document.write("</tr>");
document.write("<tr> ");
document.write("<td align=\"right\">密 码:</td>");
document.write("<td><input name=\"password\" type=\"password\" size=\"15\" class=\"put_1\"></td>");
document.write("</tr>");
document.write("</table>");
document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">");
document.write("<tr>");
document.write("<td><input type=\"submit\" name=\"Submit\" value=\"会员登录\" class=\"bt_bg01\"></td>");
document.write("<td><input type=\"button\" name=\"forget\" value=\"忘记密码\" class=\"bt_bg01\" onclick=\"window.location.href='/forget_password.html'\"></td>");
document.write("<td><input type=\"button\" name=\"apply\" value=\"会员申请\" class=\"bt_bg01\" onclick=\"window.location.href='/reg_1.html'\"></td>");
document.write("</tr>");
document.write("<tr> ");
document.write("<td height=3></td>");
document.write("<td height=3>");
document.write("");
document.write("</td>");
document.write("</tr>");
document.write("</table>");
document.write("</td>");
document.write("</tr>");
document.write("</table>");
document.write("<input type=\"hidden\" name=\"comefrom\" value=\"login.js\">");
document.write("</form>");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -