Home >> Tutorials >> Advanced javascript tutorials

Form validationSet field value
Checkbox exampleRadio box example
Move slected values from one list box to another
Setting a text field value using javascript

Some times you need to get or set values of form fields.The script that sets the value of form field. 

<INPUT TYPE="button" VALUE="Set Value" onClick="this.form.feedback.value= 'This is an example for Setting field value using a button';">

Complete javascript Source Code:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> 
<html> 
<head> 
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
</head> 
<body> 
<b><font face="Verdana"><font size=+1>Set Field Value Example :</font></font></b> 
<br> 
<br><form name="feedback" action="mailto:webgimmicks@email.com" method=post> 
<dl> 
<dt><dt> 
<font face="Verdana">Feedback:</font></dt><dt> 
<textarea rows=7 cols=60 name="feedback"></textarea></dt> 
</dl> 
<INPUT TYPE="button" VALUE="Set Value" onClick="this.form.feedback.value= 'This is an example for Setting field value using a button';"> 
<input type="reset" value="Reset"></form> 
</body> 
</html> 

  
 Top
 

Page contents: itechies.net – Learn how to set a field value in a form using javascript