how do you get the value of textfield1 to appear on textfield2?

for example..

during registration/when filling up a form:

firstname: //input type.... name="fname"// john

lastname: //input type.... name="lname"// smith

email: john_smith ????

i want the value of the firstname and lastname to appear on the email textfield.. please help.