有没有办法保持2个文本框相同??? [英] Is there a way to keep 2 textboxes the same???

查看:48
本文介绍了有没有办法保持2个文本框相同???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法在同一个表单上有两个文本框,其中第一个文本框的值始终是第二个文本框的值(甚至是onload)?

Is there a way have 2 textboxes on the same form where the value of the
first textbox is always the value of the 2nd textbox (even onload)?

推荐答案

le*****@mittalsteel.com 写于2006年1月20日在comp.lang.javascript
le*****@mittalsteel.com wrote on 20 jan 2006 in comp.lang.javascript:
有没有办法在同一个表格上有2个文本框,其中的值为
第一个文本框总是第二个文本框的值(甚至是onload)?
Is there a way have 2 textboxes on the same form where the value of the
first textbox is always the value of the 2nd textbox (even onload)?




< input id = t1

onkeyup =''的document.getElementById(QUOT; T2")值=此。值''>

< br>

< input id = t2

onkeyup =''document.getElementById(" t1" ;)值=此。价值''>

-

Evertjan。

荷兰。

(请更改x'我的电子邮件地址中的点数。



<input id=t1
onkeyup=''document.getElementById("t2").value=this. value''>
<br>
<input id=t2
onkeyup=''document.getElementById("t1").value=this. value''>
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


非常感谢您的回复。


onkeyup事件是否会被触发onload ?

Thank you very much for your reply.

Will the onkeyup event get triggered onload?


le ***** @ mittalsteel.com 2006年1月20日在comp.lang.javascript中写道
le*****@mittalsteel.com wrote on 20 jan 2006 in comp.lang.javascript:
非常感谢您的回复。

onkeyup事件是否会被触发onload?
Thank you very much for your reply.

Will the onkeyup event get triggered onload?




不,但你为什么要这样做?

在加载时两个<输入'是空的,


或者你用相同的值填充它们,例如:


< input value =''blah ''>

<输入值=''blah''>


或者您可以通过onload脚本填写两者:


< body onload =''document.getElementById(" t1& quot;)。value =

document.getElementById(" t2")。value =" blah"''>


-

Evertjan。

荷兰。

(请将x''es更改为我的电子邮件地址中的点数)



No, but why should you?

At load time both <input''s are empty,

or you van fill them with the same value, like:

<input value=''blah''>
<input value=''blah''>

or you can fill both by an onload script:

<body onload = ''document.getElementById("t1").value=
document.getElementById("t2").value="blah"''>

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


这篇关于有没有办法保持2个文本框相同???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆