<script language="JavaScript">
function checkid(iden,year,month,day){

if (iden.value.length==15) {


if ((iden.value.lastIndexOf(month.value+day.value))==8) {

return true;
}
return false;
}
if (iden.value.length==18) {


if ((iden.value.indexOf(year.value+month.value+day.value))==6) {

return true;
}
return false;
}

return false;
}


function isCharsInBag (s, bag)
{
var i;
for (i = 0; i < s.length; i++)
{
var c = s.charAt(i);
if (bag.indexOf(c) == -1) return false;
}
return true;
}
function isEmpty(s)
{
return ((s == null) || (s.length == 0))
}

function isWhitespace (s)
{
var whitespace = " \t\n\r";
var i;
for (i = 0; i < s.length; i++)
{
var c = s.charAt(i);
if (whitespace.indexOf(c) >= 0)
{
return true;
}
}
return false;
}
function isEmail (s,t)
{
if (isEmpty(s))
{
window.alert("输入的E-mail地址不能为空,请输入!");
mobj = eval(t);
mobj.focus();
mobj.select();
return false
}
if (isWhitespace(s))
{
window.alert("输入的E-mail地址中不能包含空格符,请重新输入!");
mobj = eval(t)
mobj.focus()
mobj.select()
return false;
}
var i = 1;
var len = s.length;

if (len > 50)
{
window.alert("email地址长度不能超过50位!");
mobj = eval(t)
mobj.focus()
mobj.select()
return false;
}

pos1 = s.indexOf("@");
pos2 = s.indexOf(".");
pos3 = s.lastIndexOf("@");
pos4 = s.lastIndexOf(".");
if ((pos1 <= 0)||(pos1 == len)||(pos2 <= 0)||(pos2 == len))
{
window.alert("请输入有效的E-mail地址!");
mobj = eval(t)
mobj.focus()
mobj.select()
return false;
}
else
{
if( (pos1 == pos2 - 1) || (pos1 == pos2 + 1)
|| ( pos1 != pos3 )
|| ( pos4 < pos3 ) )
{
window.alert("请输入有效的E-mail地址!");
mobj = eval(t)
mobj.focus()
mobj.select()
return false;
}
}

if ( !isCharsInBag( s, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@"))
{
window.alert("email地址中只能包含字符ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@\n" + "请重新输入" );
mobj = eval(t)
mobj.focus()
return false;
}
return true;
}
function isnumber(str){
var digits="1234567890";
var i=0;
var strlen=str.length;
while((i<strlen)){
var char=str.charAt(i);
if(digits.indexOf(char)==-1)return false;i++;
}
return true;
}
function isnumbercode(str){
var digits="1234567890-/";
var i=0;
var strlen=str.length;
while((i<strlen)){
var char=str.charAt(i);
if(digits.indexOf(char)==-1)return false;i++;
}
return true;
}
</script>

<script language=javascript>
function checkForm(theform){
if (document.frm.companyname.value.length==0){
alert("单位名称不能为空。");
mobj = eval("document.frm.companyname");
mobj.focus()
mobj.select()
return false;
}

if (document.frm.address.value.length==0){
alert("单位地址不能为空");
mobj = eval("document.frm.address");
mobj.focus()
mobj.select()
return false;
}

if (document.frm.invest.value.length==0){
alert("投资额不能为空");
mobj = eval("document.frm.invest");
mobj.focus()
mobj.select()
return false;
}
if (document.frm.codeornumber.value.length==0){
alert("法人代码证书号或营业执照编号不能为空");
mobj = eval("document.frm.codeornumber");
mobj.focus()
mobj.select()
return false;
}

if (document.frm.linkman.value.length==0){
alert("联系人不能为空");
mobj = eval("document.frm.linkman");
mobj.focus()
mobj.select()
return false;
}
if (document.frm.linkmanjob.value.length==0){
alert("联系人职位不能为空");
mobj = eval("document.frm.linkmanjob");
mobj.focus()
mobj.select()
return false;
}
if (document.frm.phone.value.length==0){
alert("电话不能为空");
mobj = eval("document.frm.phone");
mobj.focus()
mobj.select()
return false;
}

if (document.frm.email.value=='') {
window.alert ("请输入您的E-mail地址 !")
mobj = eval("document.frm.email");
mobj.focus()
mobj.select()
return false
}
if ( !isEmail(document.frm.email.value,document.frm.email) )
return false
if (document.frm.introduction.value.length==0){
alert("公司简介不能为空");
mobj = eval("document.frm.introduction");
mobj.focus()
mobj.select()
return false;
}
if (document.frm.positionname.value.length==0){
alert("职位名称不能为空");
mobj = eval("document.frm.positionname");
mobj.focus()
mobj.select()
return false;
}
if (document.frm.jobaddress.value.length==0){
alert("工作地点不能为空");
mobj = eval("document.frm.jobaddress");
mobj.focus()
mobj.select()
return false;
}
if (document.frm.jobfunction.value.length==0){
alert("工作职责不能为空");
mobj = eval("document.frm.jobfunction");
mobj.focus()
mobj.select()
return false;
}
if (document.frm.positionrequre.value.length==0){
alert("职位要求不能为空");
mobj = eval("document.frm.positionrequre");
mobj.focus()
mobj.select()
return false;
}
if (document.frm.salary.value.length==0){
alert("待遇不能为空");
mobj = eval("document.frm.salary");
mobj.focus()
mobj.select()
return false;
}
}
</script>
 


<INPUT TYPE="button" value="登录"  tabindex="4">

<INPUT TYPE="button" value="注册"  tabindex="4">

function trim(inputstr) //去处空格,在获取客户端录入的表单信息前,
都先trim一下再提交 例如:“form1.org_name.value = trim(form1.org_name.value);”
{
if(!inputstr.length>0) return "";
var starts=0;
var ends=inputstr.length;
while(starts<ends)
{
if(inputstr.substring(starts,starts+1)==" ")
starts++;
else
break;
}
while(starts<ends)
{
if(inputstr.substring(ends-1,ends)==" ")
ends--;
else
break;
}
return inputstr.substring(starts,ends);
}

function isvalidcode(inputs) //校验邮政编码
{
var i,temp;
var isvalidcode = true;
inputstr=trim(inputs);
if(inputstr.length==null||inputstr.length==0||inputstr.length!=6) return false;
for(i=0;i<inputstr.length;i++)
{
temp=inputstr.substring(i,i+1);

if(!(temp>="0" && temp<="9"))
{
isvalidcode=false;
break;
}
}
return isvalidcode;
}

function isvalidtel(inputs) //校验电话号码
{
var i,temp;
var isvalidtel = true;
inputstr=trim(inputs);
if(inputstr.length==null||inputstr.length==0) return false;
for(i=0;i<inputstr.length;i++)
{
temp=inputstr.substring(i,i+1);

if(!(temp>="0" && temp<="9" || temp=="-"))
{
isvalidtel=false;
break;
}
}
return isvalidtel;
}

function isrealnum(inputs) //校验实数(含小数点)
{
var i,temp;
var isrealnum = true;
inputstr=trim(inputs);
if(inputstr.length==null||inputstr.length==0) return false;
for(i=0;i<inputstr.length;i++)
{
temp=inputstr.substring(i,i+1);

if(!(temp>="0" && temp<="9" || temp=="."))
{
isrealnum=false;
break;
}
}
return isrealnum;
}

function isnumeric(inputs) //校验是否整数
{
var i,temp;
var isnumeric = true;
inputstr=trim(inputs);
if(inputstr.length==null||inputstr.length==0) return false;
//isvalid = true;
for(i=0;i<inputstr.length;i++)
{
temp=inputstr.substring(i,i+1);

if(!(temp>="0" && temp<="9"))
{
isnumeric=false;
break;
}
}
return isnumeric;
}

function isvalidide(inputs) //校验身份证
{
var i,temp;
var isvalidide = true;
inputstr=trim(inputs);
if(inputstr.length == null || inputstr.length == 0 || (inputstr.length != 15 && inputstr.length != 18)) return false;
for(i=0;i<inputstr.length;i++)
{
temp=inputstr.substring(i,i+1);

if(!((temp>="0" && temp<="9") || temp == "x" || temp == "X"))
{
isvalidide=false;
break;
}
}
return isvalidide;
}

function isvalidname(inputs) //校验账号2~15位(即只能是英文字母和数字组成的串)
{
var i,temp;
var isvalidname = true;
inputstr=trim(inputs);
if(inputstr.length==null || inputstr.length==0 || inputstr.length > 15 || inputstr.length < 2) return false;
for(i=0;i<inputstr.length;i++)
{
temp=inputstr.substring(i,i+1);

if(!((temp >= "0" && temp <= "9") || (temp >= "a" && temp <= "z") || (temp >= "A" && temp <= "Z")))
{
isvalidname=false;
break;
}
}
return isvalidname;
}

function isvalidphoto(inputs) //校验照片扩展名
{
var i,temp;
var isvalidphoto = true;
inputstr=trim(inputs);
if(inputstr.length==null || inputstr.length==0) return true; //没有相片也允许的
temp=inputstr.substring(inputstr.lastIndexOf(".")+1);

temp = temp.toLowerCase();
if(!(temp == "bmp" || temp == "jpg" || temp == "gif"))
{
isvalidphoto=false;
}
return isvalidphoto;
}

function isvalidzgh(inputs) //校验职工号8位(即只能是英文字母和数字组成的串)
{
var i,temp;
var isvalidzgh = true;
inputstr=trim(inputs);
if(inputstr.length==null || inputstr.length==0 || inputstr.length != 8) return false;
for(i=0;i<inputstr.length;i++)
{
temp=inputstr.substring(i,i+1);

if(!((temp >= "0" && temp <= "9") || (temp >= "a" && temp <= "z") || (temp >= "A" && temp <= "Z")))
{
isvalidzgh=false;
break;
}
}
return isvalidzgh;
}

function isvalidxh(inputs) //校验学号7位(即只能是英文字母和数字组成的串)
{
var i,temp;
var isvalidxh = true;
inputstr=trim(inputs);
if(inputstr.length==null || inputstr.length==0 || inputstr.length != 7) return false;
for(i=0;i<inputstr.length;i++)
{
temp=inputstr.substring(i,i+1);

if(!((temp >= "0" && temp <= "9") || (temp >= "a" && temp <= "z") || (temp >= "A" && temp <= "Z")))
{
isvalidxh=false;
break;
}
}
return isvalidxh;
}

function isvalidkcid(inputs) //校验课程编号5位(即只能是数字组成的串)
{
var i,temp;
var isvalidkcid = true;
inputstr=trim(inputs);
if(inputstr.length==null||inputstr.length==0||inputstr.length!=5) return false;
for(i=0;i<inputstr.length;i++)
{
temp=inputstr.substring(i,i+1);

if(!(temp>="0" && temp<="9"))
{
isvalidkcid=false;
break;
}
}
return isvalidkcid;
}

function isvalidnamee(inputs) //校验账号4~20位(即只能是英文字母和数字组成的串)
{
var i,temp;
var isvalidname = true;
inputstr=trim(inputs);
if(inputstr.length==null || inputstr.length==0 || inputstr.length > 20 || inputstr.length < 4) return false;
for(i=0;i<inputstr.length;i++)
{
temp=inputstr.substring(i,i+1);

if(!((temp >= "0" && temp <= "9") || (temp >= "a" && temp <= "z") || (temp >= "A" && temp <= "Z")))
{
isvalidname=false;
break;
}
}
return isvalidname;
}


<Script language="JavaScript">
function login()
{
form1.UNAME.value = trim(form1.UNAME.value);
form1.PWD.value = trim(form1.PWD.value);
form1.PWD2.value = trim(form1.PWD2.value);
form1.EMAIL.value = trim(form1.EMAIL.value);
form1.NC.value = trim(form1.NC.value);
if(!isvalidname(form1.UNAME.value))
{
alert("请您注意:用户名必须为『2~15位英文或数字』!");
form1.UNAME.focus();
return false;
}
else if(!isvalidname(form1.PWD.value))
{
alert("请您注意:密码必须为『2~15位英文或数字』!");
form1.PWD.focus();
return false;
}
else if(!isvalidname(form1.PWD2.value))
{
alert("请您注意:密码确认也必须为『2~15位英文或数字』!");
form1.PWD2.focus();
return false;
}
else if(form1.PWD.value != form1.PWD2.value)
{
alert("两次密码不一致!");
form1.PWD.focus();
return false;
}
else if(form1.EMAIL.value == "" || form1.EMAIL.value.length > 100)
{
alert("请输入邮件!");
form1.EMAIL.focus();
return false;
}
else if(form1.NC.value == "" || form1.NC.value.length > 15)
{
alert("请输入昵称!");
form1.NC.focus();
return false;
}
else if(window.confirm("您确信提交!"))
return true;
else
return false;
}

function regedit()
{
var litop = (screen.height - 162)/2;
var lileft = (screen.width - 360)/2;
window.open("/regedit.aspx", "reg", "titlebar=no,fullscreen=no,dependent=yes,height=162,width=360,
top=" + litop + ",left=" + lileft + ",
toolbar=no,menubar=no,scrollbars=no,resizable=no,
channelmode=no,status=no,location=no,directories=no");
}
</Script>
posted on 2008-07-09 17:06  沉默的心  阅读(496)  评论(0编辑  收藏  举报