<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>---------------------------------------
直接可以运行
<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>---------------------------------------
直接可以运行
var s1;
var s2;function confirmText(){
if(!s1){ s1=txt1.value; txt1.value=''; alert('再次输入'); }
else{ s2=txt1.value; if(s1!=s2){ txt1.value=''; alert('再次输入');} }</script>
<input id=txt1 type=text><input type=button onclick=conformText()>