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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onClick function perhaps?

Status
Not open for further replies.

planeboy747

Technical User
Joined
Jan 11, 2005
Messages
41
Location
US
I have 3 fields. Here are their id's

"name"
"date"
"time"

When a button is clicked, I need the value of those 3 fields to be populated into these field id's.

"confirmation1" <--for the "name" field
"confirmation2" <--for the "date" field
"confirmation3" <--for the "time" field

How do I show this in the script?


Thanks
j
 
1) give your fields names, ids are optional.

2) use this function:
Code:
<script language="javascript"><!--
function doThing() {
    var f = document.forms['formname'];
    f.elements['confirmation1'].value = f.elements['name'].value;
    f.elements['confirmation2'].value = f.elements['date'].value;
    f.elements['confirmation3'].value = f.elements['time'].value;
}
--></script>
call it like this:
Code:
<input type="button" value="click" onclick="doThing(); return false;" />

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top