Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textboxes

Status
Not open for further replies.

lomano

Programmer
Nov 15, 2000
18
CA
How can I take the value entered into one textbox and place it into another textbox
 
Lomano,

Try this...
Code:
<html>
<head>
<script language=&quot;javascript&quot;>
 function MoveIt(){
  var z=document.forms.frmDemo
  z.txt2.value = z.txt1.value
 }
</script>
</head>
<body>
<form id=frmDemo>
 Type here: <input type=text id=txt1 value=&quot;&quot;><br>
 <input type=button value=&quot; Move  &quot; onClick=&quot;MoveIt()&quot;>
 <input type=text id=txt2 value=&quot;&quot; readonly><br>
</form>
</body>
<html>

Hope it helps, Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
function copyValueToBox(obj1,obj2)
{obj2.value=obj1.value}

So if you have one named peter and one named paul, and paul has the value you want peter to get as well you say

copyValuetoBox(paul,peter)

if you want to move the value you could alter the function:
function moveValueToBox(obj1,obj2)
{obj2.value=obj1.value;obj1.value=''} jared@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top