现在有三个文本框 第一个输入onblur后 第二个文本框的值可以 自动等于第一个框的值
1、如果 两个文本框的值相同 第三个框的 值 为空 或者不能填写 或者不能选择
2、如果前两个文本框的值不同 第三个框才能填写 或者选择
1、如果 两个文本框的值相同 第三个框的 值 为空 或者不能填写 或者不能选择
2、如果前两个文本框的值不同 第三个框才能填写 或者选择
调试欢乐多
<input type="text" id="zdz" > <input type="text" id="shfs">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<title>new document</title>
<script type="text/javascript">
function $(id){
return document.getElementById(id);
}
function check(obj){
if(obj.value != "" && obj.value == $("sdz").value){
$("shfs").value = "";
$("shfs").disabled = true;
}else{
$("shfs").disabled = false;
}
}
</script>
</head>
<body>
<input type="text" id="sdz" onblur="$('zdz').value = this.value">
<input type="text" id="zdz" onblur="check(this)" > <input type="text" id="shfs" onfocus="check($('zdz'))"></body>
</html>
这样的?
<html>
<head>
<title>new document</title>
<script type="text/javascript">
function $(id){
return document.getElementById(id);
}
function check(obj){
if(obj.value != "" && obj.value == $("sdz").value){
$("shfs").value = "";
$("shfs").disabled = true;
}else{
$("shfs").disabled = false;
}
}
</script>
</head>
<body>
<input type="text" id="sdz" onblur="$('zdz').value = this.value">
<input type="text" id="zdz" onblur="check(this)" > <input type="text" id="shfs"></body>
</html>
去掉shfs的 onfocus事件
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title><script>function resetInput2Input3State() {
input2.value = input1.value;
resetInput3State();
}function resetInput3State() {
if (input1.value == input2.value) {
input3.value = "";
input3.readOnly = true;
} else {
input3.readOnly = false;
}
}</script></head><body> <input type="text" id="input1" onchange="resetInput3State();" onblur="resetInput2Input3State()"/>
<br/>
<br/>
<input type="text" id="input2" onchange="resetInput3State();"/>
<br/>
<br/>
<input type="text" id="input3"/></body></html>