function checkName(data){
//校驗聯系信息不能一致
var values="";
$(".t").each(function(i,item){
var value=$(this).val();
values+=value; //獲取所有的名稱
});
var val=$(data).val(); //獲得當前輸入框的值
var newValue=values.replace(val,""); //去除當前輸入框的值
if(newValue==""){
return false;
}else{
if(newValue.indexOf(val)>-1){ //當前值和newValue作比較
alert("聯系人,緊急聯系人,法人三者聯系信息不能一致!");
$(data).focus();
}
}
}
<input name="inputname" class="t" onchange="checkName(this);"/>
<input name="inputname" class="t" onchange="checkName(this);"/>
<input name="inputname" class="t" onchange="checkName(this);"/>