Copy from one form to another in Javascript

08-01-2002, 02:04 AM
I have one page which contains two HTML forms. What I want is to have a bit of java script which will copy the contents of a textbox (call it txtSource) on one of the forms to another textbox (txtDestination) on the other form when a button on the first form is clicked. Can anybody show me how to do this? Thanks.

08-01-2002, 02:21 AM
try this out....



<script language="JavaScript">
function test(){
f2.elements["t2"].value = f1.elements["t1"].value


<form method="POST" name="f1">
<input type="text" name="t1" >

<form method="POST" name="f2">
<input type="text" name="t2">

<input type="button" value="test" name="B1" onclick=test()>



08-01-2002, 01:37 PM
Have a gander at this thread (

08-31-2002, 04:07 AM
The best way to do that is not JS but ASP/PHP !

Derek Stone
08-31-2002, 07:20 PM
The best way to do that is not JS but ASP/PHP !

Not necessarily.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum