📄 personsetvalidate.js
字号:
/**
*
*/
window.phoneEnum = [5, 10, 20, 15];
//给地区父控件设置选中值
function SetSelectedValueType( objName,varValue )
{
for( var i=0; i < document.all(objName).length; i ++ )
{
if( document.all(objName).options[i].value == varValue )
{
document.all(objName).selectedIndex = i;
break;
}
}
}
//给地区子控件设置选中值
function SetSelectedValueList( objName,varValue )
{
var strCity = objName;
var strState = strCity.replace('City','State');
changeChildList(document.all[strState],document.all[strCity]) //选中当前父控件的子项目(调用onchange)
for( var i=0; i < document.all(objName).length; i ++ )
{
if( document.all(objName).options[i].value == varValue )
{
document.all(objName).selectedIndex = i;
break;
}
}
}
function InitForm()
{
var txtValue = document.all['ResidenceCity'].value;
var txtLength = document.all['ResidenceCity'].value.length;
var SplitValue = txtValue.substring(txtLength-1,txtLength) //最后一位是1
//是否选择了其它城市
if (SplitValue == "1")
{
//显示其它城市输入框及说明
document.all['TrOtherCity'].style.display = "";
document.all['_valid_OtherResidence'].enabled = true;
}
ChangeIDType();
limitContactType(document.getElementById("contact_type1"), document.getElementById("contact_no1"));
for (var i=1; i<=3; i++)
{
ChangeContactType(document.getElementById("contact_type" + i), i, false);
}
}
function SelectCity()
{
var txtValue = document.all['ResidenceCity'].value;
var txtLength = document.all['ResidenceCity'].value.length;
var SplitValue = txtValue.substring(txtLength-1,txtLength) //最后一位是1
//是否选择了其它城市
if (SplitValue == "1")
{
//显示其它城市输入框及说明
document.all['TrOtherCity'].style.display = "";
document.all['_valid_OtherResidence'].enabled = true;
}
else
{
//隐藏其它城市输入框及说明
document.all['TrOtherCity'].style.display = "none";
document.all['_valid_OtherResidence'].enabled = false;
}
}
window.__jsAlert = window.alert;
window.alert = function()
{
var msg = arguments[0];
for(var i=1; i<arguments.length; i++)
{
msg = msg.replace("%s", arguments[i]);
}
__jsAlert(msg);
};
function limitContactType(ctlContactType, ctlContactNo)
{
var optionsCount = ctlContactType.options.length;
var contactType = ctlContactType.value;
var items = new Array();
for(var i=0; i<phoneEnum.length; i++)
{
for (var j=0; j<optionsCount; j++)
{
if (ctlContactType.options[j].value == phoneEnum[i])
{
items[i] = [ctlContactType.options[j].text, phoneEnum[i]];
break;
}
}
}
ctlContactType.options.length = 0; //清空, 重新填充选项
var contactTypeIsPhone = false;
for(var i=0; i<phoneEnum.length; i++)
{
ctlContactType.options[i] = new Option(items[i][0], items[i][1]);
if (contactType == items[i][1])
{
ctlContactType.options[i].selected = true;
contactTypeIsPhone = true;
}
}
if (false == contactTypeIsPhone)
{
ctlContactNo.value = "";
alert("为确保招聘企业能及时联系到您,第一联系方式须填写电话,建议填写手机号码和家庭电话。");
}
}
function ChangeContactType(ctlContactType, typeIndex)
{
var contactType = ctlContactType.value;
var contactTypeIsPhone = false;
for(var i=0; i<phoneEnum.length; i++)
{
if (contactType == 5)
{
document.getElementById('_valid_mobile' + typeIndex).enabled = true;
document.getElementById('_valid_phone' + typeIndex).enabled = false;
contactTypeIsPhone = true;
break;
}
else if (contactType == phoneEnum[i])
{
document.getElementById('_valid_mobile' + typeIndex).enabled = false;
document.getElementById('_valid_phone' + typeIndex).enabled = true;
contactTypeIsPhone = true;
break;
}
}
if (false == contactTypeIsPhone)
{
document.getElementById('_valid_mobile' + typeIndex).enabled = false;
document.getElementById('_valid_phone' + typeIndex).enabled = false;
}
var vals = document.getElementById("contact_no" + typeIndex).Validators;
var i;
for (i = 0; i < vals.length; i++) {
ValidatorValidate(vals[i]);
}
ValidatorUpdateIsValid();
}
function ChangeIDType()
{
if (document.all['IDType'].selectedIndex==0) //身份证
{
document.all['valid_Paper'].enabled = true;
}
else
{
document.all['valid_Paper'].enabled = false;
//document.all['RegularExpressionValidator1'].innerHTML = '';
}
}
function DisplayOtherCity(pObject,pOther)
{
if (pObject.options[pObject.options.selectedIndex].value == 252)
{
var o = document.all['TB_STU_HuKouOther'] ;
if(o!=null)
{
if(o.value=="_default")
o.value="" ;
}
pOther.style.display = "";
}
else
{
var o = document.all['TB_STU_HuKouOther'] ;
if(o!=null)
{
if(o.value==null||o.value=='')
{
o.value="_default" ;
}
}
pOther.style.display = "none";
}
}
//初始化设置
function InitSet()
{
if(typeof(PersonInfo.HuKouState)=="object")
{
initParentList(document.all['HuKouState']);
}
if(typeof(PersonInfo.ResidenceState)=="object")
{
initParentList(document.all['ResidenceState']);
}
if(typeof(PersonInfo.STU_HuKouState)=="object")
{
initParentList(document.all['STU_HuKouState']);
}
if(PersonInfo.TB_STU_HuKouOther != null)
{
if(PersonInfo.TB_STU_HuKouOther.value != '' && PersonInfo.TB_STU_HuKouOther.value != null)
{
var o = document.all['TB_STU_HuKouOther'] ;
if(o!=null)
{
if(o.value=="_default")
o.value="" ;
}
tr_pr_loc_othr.style.display = "";
}
else
{
var o = document.all['TB_STU_HuKouOther'] ;
if(o!=null)
{
if(o.value==null||o.value=='')
{
o.value="_default" ;
}
}
tr_pr_loc_othr.style.display = "none";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -