Questions | Login

Top / Javascript

Javascript Question About Forms ?

demo 19 Dec 2008 10:54pm
What I need to do is take data from a form (just 3 fields) then submit the fields which will turn into a array and be moved into another form on the same page. Once the data is transferred I would like just one of the fields to be shown in either in a table or a textarea. I would like all of this done without the page reloading... if you could give me any information or point me in the right direction that would be great!

k thnks!

Answers

demo 19 Dec 2008 11:22pm
<html>

<head>
<script type="text/javascript">

function transfer()
{

//transfer data from form to form
field1 = document.getElementById("field1");
field1Data = field1.value;

field2 = document.getElementById("field2");
field2.value = field1Data;

//transfer data from form to table
dataCell = document.getElementById("dataCell");
dataCell.innerHTML = field1Data;

return false;

}
</script>
</head>

<body>
<form id = "a">
<input type = "text" id = "field1" value = "">
<input type ="submit" value = "Submit" onclick = "return transfer();">
</form>

<hr/>

<form id = "b">
<input type = "text" id = "field2" value = "">
</form>

<hr/>

<table id = "c">
<tr>
<td id = "dataCell"></td>
</tr>
</table>

</body>
</html>

Related

Submit Answer

You must be logged in to post an answer. Please Login or Register.

Powered by phpMyAnswers.