【发布时间】:2015-03-26 09:51:01
【问题描述】:
<form action="formoneaction" method="post">
<input type="text" id="t1" />
<button type="sumbit" class="btn">Insert</button>
</form>
<form action="formtwoaction" method="post">
<input type="text" id="t2" />
<button type="sumbit" class="btn">Insert</button>
</form>
<script>
var t1 = document.getElementById('t1');
t1.onkeyup = t1.onchange = function() {
document.getElementById('t2').value = this.value;
};
</script>
当两个元素处于不同的形式时,我怎样才能让脚本工作?当它们都不在表单中时,脚本可以工作。
我以前从未学过 JS,所以当有人解释一堆行话时,我可能不太明白。对不起,我会努力的!
【问题讨论】:
-
您的代码运行良好..您还需要什么
-
什么意思,另一种形式?
-
由于某种原因,此脚本不适用于 textarea
标签: javascript html forms text copy