日期:2014-05-20  浏览次数:20752 次

有一段javascript,是四六级准考证号的...大家谁给解释一下??
<script   language= "javascript ">
var   addr   =   parent.location.toString();
var   eT   =   addr.indexOf( "etang.com ");
if(eT   <   0)   {parent.location= "http://cet.etang.com "};
//if(!parent.location   ||   parent.location==location)   location= "/index.htm ";
document.cookie   =   "zi=A;domain=.etang.com;path=/; ";  

DeleteCookie( "examid ");
DeleteCookie( "examtype ");
DeleteCookie( "score ");

function   submit1()
{
var   checkform   =   document.form1;
var   examid   =   checkform.examid.value;
var   examtype   =   checkform.examtype.value;

if   (isNaN(examid))
{
window.alert   ( '准考证号码必须是数字 ');
return   false;
}
if   (trim(examid).length!=15)   //&&   (trim(examid).length!=13))
{
window.alert   ( '准考证号码不正确 ');
return   false;
}
/*
if   (examid.substr(6,3)!= "061 "   &&   examid.substr(0,3)!= "062 ")
{
window.alert   ( '准考证号码不正确 ');
return   false;
}
if   ((examtype!=4   &&   examtype!=examid.substr(9,1))   ||   (examtype==4   &&   examid.substr(0,3)!= "062 "))
{
window.alert   ( '准考证号码与考试类型不符 ');
return   false;
}
*/
if   (examtype==1)
{
if   ((examid.substr(6,4)!= "1062 ")   &&   (examid.substr(6,4)!= "0621 "))
{
window.alert   ( '准考证号码与考试类型不符 ');
return   false;
}
}
if   (examtype==2)
{
if   (examid.substr(6,4)!= "0622 ")
{
window.alert   ( '准考证号码与考试类型不符 ');
return   false;
}
}
/**if   (examtype==4)
{
examid1   =   examid.substr(3,3)   +   examid.substr(7,1)   +   examid.substr(10,1)   +   "0 "   +   "4061 "   +   examid.substr(9,1)   +     examid.substr(11,2)   +   "0 "   +   examid.substr(6,1);
}
else
{
examid1   =   examid.substr(0,6)   +   examtype   +   "061 "   +   examid.substr(10,5);
}*/
examid1   =   examid.substr(0,6)   +   examtype   +   "062 "   +   examid.substr(10,5);
SetCookie( "examid ",   examid1);
SetCookie( "examid1 ",   examid);
SetCookie( "examtype ",   examtype);
SetCookie( "examtype1 ",   examtype);
return   true;
} </script>

------解决方案--------------------
javascript,这个我不大会哦。