一个输入框有变化,对应的输入框也要有变化,文本框的onpropertychange事件
<html>
?<head>
? <title> New Document </title>
<script>
?function cc(val){
?? document.getElementById('textid2').value=val.value;
?}
</script>
?</head>
?<body>
? <input type="text" id="textid1" name="textid1" onpropertychange="cc(this);"><br>
? <input type="text" id="textid2" name="textid2"><br>
?</body>
</html>
?
?
?
?
?
2、下面是jQuery的写法
?
<!DOCTYPE html>
<html>
<head>
? <style>
? p { color:blue; margin:8px; }
? </style>
? <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
??? <input type="text" id="inputid1" value="这里可以什么都不写"/><br><br>
??? <input type="text" id="inputid2" />
<script>
??? $("#inputid1").keyup(function () {
????? var value = $(this).val();
????? $("#inputid2").val(value);
??? }).keyup();
</script>
</body>
</html>
?