wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes Typing in two text boxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Typing in two text boxes" Watch "Typing in two text boxes" New topic
Author

Typing in two text boxes

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1526
I want to copy contents of one text from one into another this has to happen in real time as if I am typing in two text boxes simultaneously, how can I achieve this using javascript?



Above code lags by one key press.


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1526
I am trying keypress event but it is showing blank for all the characters alert is just "Character typed: ".


Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1526
Got it.

<html>
<script>
function copyTextBoxes(evt) {
// evt = window.event;
var groupNameTxt = document.getElementById('groupName');
var fnameTxt = document.getElementById('fname');
groupNameTxt.value=fnameTxt.value + " Users";
}


</script>
<body>
<form name="addLDAPApplicationGroup" action="demo_form.asp">
<input type="text" id="groupName" name="groupName" disabled value="disabled">

<input type="text" id="fname" name="fname" onKeyUp="copyTextBoxes(this)" onmouseup="copyTextBoxes(this)" onmouseover="copyTextBoxes(this)">

<input type="button" value="Submit">
</form>
</body>
</html>

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Typing in two text boxes
 
Similar Threads
JS code not working.
How to remove Textbox Element using DOM in HTML
translate from English to Hindi
Is onSubmit() mandatory to write when SimpleFormController is used?
How to get back in old window from a new window