开发者

If am entering some values in text box it should be simultaneously displayed in the other text box using html and js

开发者 https://www.devze.com 2023-01-04 16:55 出处:网络
If am entering some values in text box it should be simultaneously displayed in other text box using html and js in the same page.

If am entering some values in text box it should be simultaneously displayed in other text box using html and js in the same page.

That is if i enter test in text box then the other text box should contain the alphabet test imm开发者_StackOverflow中文版ediately.

Is that possible. If yes how?

kindly clarify.

thanks in advance


Use the onkeydown event, combined with a timer that will execute immediately afterwards:

textbox1.onkeydown = function () { 
    window.setTimeout(function () { textbox2.value = textbox1.value; }, 0);
}

Example

For Opera, you will need to use onkeypress to capture repeated input (holding the key down).

0

精彩评论

暂无评论...
验证码 换一张
取 消