Copy from one form to another in Javascript

adouglas
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.

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


<html>

<head>

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

<body>

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

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

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

</body>

</html>

Rezner
08-01-2002, 01:37 PM
Have a gander at this thread (http://www.visualbasicforum.com/showthread.php?threadid=33467).

d1rtyw0rm
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