//$Id: checkForm.js,$
//tony 2004-3-30
//新增了对form的查询条件进行自动拼装的功能getQueryString();
/**
* 检查送出的form的每个表单元素是否符合填写要求
* @fm 需要检查的form元素。
* @return 如果form的所有表单元素都符合要求,将返回true,
* 否则将会报告不符合的原因,同时返回false。
* 示例:
* <form onsubmit="return checkForm(this)">
* <input type=submit>
* <input name=email title="请填写邮件地址~email!">
* </form>
* 说明:
* 在form表单元素的title属性中指明此表单元素期望的格式。
* 此格式说明如下
* 请填写邮件地址~email!
* 以最后一个"~"为界,前面的是提示信息,后面是格式信息。
* 格式信息请遵守以下规则:
* [number[f]:][type][!]
* 说明:
* number[f]: 一个数值后面跟一个":",表示此域的文本长度不可以超过指定的数值,如果在数值后面有个f表示固定长度必须为多少位
* type可以是如下表达式
* email 邮件地址
* int 整数
* float 浮点数
* date 日期
* time 时间
* hasChinese 含有中文
* allChinese 全部是中文
* noChinese 没有中文
* /.../[gi] 自定义正则式
* !表示此处文本不可以为空。
* 对于<input type=radio > 格式串为
* "请选择一个选项~!"表示此radio组必须选择一个选项
* "请选择一个选项~"表示此radio组的选项可以不选。
* 对于<input type=checkbox >或者<select multiple></select>格式串的意义为
* 说明信息~min:0max:3
* 对于<select ></select>非multiple类型
* "请选择一个选项~!"表示此select不可以选择第一个选项
* "请选择一个选项~"表示此select可以选择第一个选项
*/
function killErrors() {
return true;
}
function checkForm(fm)
{
//window.onerror = killErrors;
for(var i=0;i<fm.length;i++)
{
var title=fm[i].title;
if(title=="")continue;//忽略未定义title的元素
var p=title.lastIndexOf("~");
if(p<0)continue;//忽略title中未定义检查格式的元素
var info=title.substring(0,p);
var format=title.substring(p+1,title.length);
var format1=title.substring(p+1,title.length);
var format2=title.substring(p+1,title.length);
var name=fm[i].name;
if(name=="")continue;//忽略没有名字的元素
var value=trim(fm[i].value);
//fm[i].value=value;//自动除去送出项的两端的空格
if(fm[i].type=="radio")
{
if(checkRadio(fm,fm[i]))
{
continue;
}
else
{
return false;
}
}
if(fm[i].type=="checkbox")
{
if(checkCheckbox(fm,fm[i]))
{
continue;
}
else
{
return false;
}
}
if(fm[i].type=="select-one")
{
if(checkSelectOne(fm[i]))
{
continue;
}
else
{
return false;
}
}
if(fm[i].type=="select-multiple")
{
if(checkSelectMultiple(fm[i]))
{
continue;
}
else
{
return false;
}
}
var notNull=false;
if(format.charAt(format.length-1)=="!")
{
notNull=true;
format=format.substring(0,format.length-1);
}
if(notNull)
{
if(value=="")
{
//alert(info+"\n"+name+"的内容不可以为空。");
alert(info+"\n其内容不可以为空。");
try {
fm[i].focus();
}
catch (e){
}
finally {
}
return false;
}
}
else
{
//内容可以为空时,
if(value=="")
continue;
}
///判断是否为int类型
if(format2.charAt(format2.length-1)=="!")
{
format2=format2.substring(0,format2.length-1);
}
var colonP2=format2.indexOf(":");
format2=format2.substring(colonP2+1,format2.length);
//alert (format2);
var colonP=format.indexOf(":");
if(format2 != "int")
{
//内容的长度判断
//var colonP=format.indexOf(":");
if(colonP>0)
{
if(format.charAt(colonP-1)=='f')
{
var lengthLimit=format.substring(0,colonP-1);
if(!isNaN(lengthLimit))
{
if(value.length!=lengthLimit)
{
//alert(info+"\n"+name+"的长度为"+value.length+"位,必须为"+lengthLimit+"位");
alert(info+"\n其长度为"+value.length+"位,必须为"+lengthLimit+"位");
fm[i].focus();
return false;
}
}
}
else
{
var lengthLimit=format.substring(0,colonP);
if(!isNaN(lengthLimit))
{
if(value.length>lengthLimit)
{
//alert(info+"\n"+name+"的长度("+value.length+")超过限制"+lengthLimit);
alert(info+"\n其长度("+value.length+")超过限制"+lengthLimit);
fm[i].focus();
return false;
}
}
}
}
}
format=format.substring(colonP+1,format.length);
//alert (format);
if(format=="email")
{
//电子邮件格式
var found=value.match(/\w+@.+\..+/);
if(found==null)
{
//alert(info+"\n"+name+"的格式不正确:\n\""+value+"\"不是一个Email地址");
alert(info+"\n其格式不正确:\n\""+value+"\"不是一个Email地址");
fm[i].focus();
return false;
}
}
else if(format=="int")
{
//整数
var intVal=parseInt(value);
if(isNaN(intVal)||intVal!=value)
{
//alert(info+"\n"+name+"的格式不正确:\n"+value+"不是一个整数。");
alert(info+"\n其格式不正确:\n"+value+"不是一个整数。");
fm[i].focus();
return false;
}
//内容的值的大小判断
var colonP=format1.indexOf(":");
if(colonP>0)
{
var lengthLimit=format1.substring(0,colonP);
if(!isNaN(lengthLimit))
{//alert(value);
if(parseInt(value)>parseInt(lengthLimit))
{
//alert(info+"\n"+name+"的长度("+value.length+")超过限制"+lengthLimit);
alert(info+"\n其值("+value+")超过限制"+lengthLimit);
fm[i].focus();
return false;
}
}
}
}
else if(format=="float")
{
//浮点数
var floatVal=parseFloat(value);
if(isNaN(floatVal)||floatVal!=value)
{
//alert(info+"\n"+name+"的格式不正确:\n"+value+"不是一个浮点数。");
alert(info+"\n其格式不正确:\n"+value+"不是一个浮点数。");
fm[i].focus();
return false;
}
}
else if(format=="date")
{
//日期
var found=value.match(/(\d{1,5})-(\d{1,2})-(\d{1,2})/);
var found2=value.match(/(\d{1,5})\/(\d{1,2})\/(\d{1,2})/);
if(found==null||found[0]!=value||found[2]>12||found[3]>31)
{
if(found2==null||found2[0]!=value||found2[2]>12||found2[3]>31)
{
//alert(info+"\n"+name+"的格式不正确:\n\""+value+"\"不是一个日期\n提示:[2000-01-01]");
alert(info+"\n其格式不正确:\n\""+value+"\"不是一个日期\n提示:[2000-01-01]");
fm[i].focus();
return false;
}
}
var year=trim0(found[1]);
var month=trim0(found[2])-1;
var date=trim0(found[3]);
var d=new Date(year,month,date);
if(d.getFullYear()!=year||d.getMonth()!=month||d.getDate()!=date)
{
//alert(info+"\n"+name+"的内容不正确:\n\""+value+"\"不是一个正确的日期\n提示:[2000-01-01]");
alert(info+"\n其内容不正确:\n\""+value+"\"不是一个正确的日期\n提示:[2000-01-01]");
fm[i].focus();
return false;
}
}
else if (format=="datetime")
{
//alert(isDateStr(value));
if (!isDateStr(value))
{
alert(info+"\n其内容不正确:\n\""+value+"\"不是一个正确的日期时间\n提示:[2000-01-01 05:38:00]");
fm[i].focus();
return false;
}
}
else if(format=="time"
没有合适的资源?快使用搜索试试~ 我知道了~
asp.net会员管理系统
共59个文件
gif:29个
cs:8个
aspx:6个
5星 · 超过95%的资源 需积分: 13 117 下载量 155 浏览量
2014-03-08
11:48:07
上传
评论
收藏 532KB RAR 举报
温馨提示
本设计主要是运用Microsoft Visual Studio.NET2008开发工具基于B/S架构的asp.net通用会员管理系统,系统主要设计完成用户登录,会员分类信息管理、会员信息管理、消费项目信息管理、消费管理、信息检索查询、消费报表生成等。
资源推荐
资源详情
资源评论
收起资源包目录
328ASP.NET会员管理系统.rar (59个子文件)
328ASP.NET通用会员管理系统
通用会员管理软件
tongyonghuiyuan
addxfcp.aspx 2KB
addxf.aspx 5KB
web.config 10KB
addxfcp.aspx.cs 1KB
addxf.aspx.cs 3KB
addUser.aspx 2KB
addtype.aspx.cs 1KB
images
css.css 10KB
Logon
Logon_10.gif 3KB
Logon_8.gif 1KB
Logon_11.gif 3KB
Logon_9.gif 3KB
Logon_6.gif 1KB
Logon_7no.gif 1KB
Logon_7.gif 2KB
Logon_4.gif 1KB
Logon_18.jpg 6KB
Logon_5.gif 2KB
Thumbs.db 6KB
Logon_3.gif 2KB
Logon_2.gif 2KB
Logon_1.gif 13KB
ve-C1.tmp 3KB
rili.gif 1KB
Index
vssver2.scc 531B
top-b-3.gif 71B
top-b4-1.gif 523B
top-b-2-1-2.gif 697B
top-b-2-2.gif 201B
top-b4-2.gif 308B
top-b4-b.gif 173B
top-2-1.gif 442B
top-b-2.gif 201B
menubg.jpg 900B
Thumbs.db 29KB
menu1bg.gif 416B
top-b4-c.gif 54B
top-b4-yellow.gif 198B
top-b-3-2.gif 75B
top-b-1.gif 61B
top-2-2.gif 76B
logon.gif 635B
ve-C2.tmp 3KB
top-gray.gif 2KB
Site_Css.css 5KB
style.css 3KB
login.aspx.cs 2KB
js
checkform.js 28KB
App_Code
Datacon.cs 3KB
DB.cs 2KB
addhy.aspx.cs 2KB
login.aspx 120B
vwd.webinfo 250B
App_Data
tyhuiyuan.mdf 3MB
addhy.aspx 6KB
CrystalReport1.rpt 32KB
addUser.aspx.cs 2KB
addtype.aspx 1KB
asp.net通用会员管理系统.exe 395KB
共 59 条
- 1
资源评论
- xypcn2014-05-01可以可以,不错O
- 12509593682014-04-17不错,值得学习
- 沙加Happy2014-03-12除了这些消费,方便店主对自己的经营情况进行分析,会员管理系统还应该有统计的功能。 这些功能都是会员管理系统应该有的,还有一些辅助的功能,比如打印小票等
netsj8
- 粉丝: 7
- 资源: 19
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功