首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

一个输入框有变更,对应的输入框也要有变化,文本框的onpropertychange事件

2012-07-19 
一个输入框有变化,对应的输入框也要有变化,文本框的onpropertychange事件html?head? title New Docu

一个输入框有变化,对应的输入框也要有变化,文本框的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>

?

热点排行