<html>
<head>
<script>
function do1(){
var first=document.all.id.value;
if(document.all.flag.value=="1"){
document.all.id1.value=first;
document.all.id.value="";
document.all.flag.value="2";
}
else if(document.all.id1.value!=first&&document.all.flag.value!="1"){
        alert("2次数据不一致请重新输入"); 
document.all.id.value="";
}else {
alert("2次数据一致!");
}
}
</script>
</head><body>
<input type="hidden" name="flag" value="1">
<input type="text" name="id" value="" onblur=do1()>
<input type="hidden" name="id1"  value="" >
</body>
</html>---------------------------------------
直接可以运行