Richard's JavaScript Tutorials

Using forms with JavaScript

Home
Animation
precachedImages
digitalClock
Object Tag (Audio)
Cookies.htm
Math_Object
Using CSS
The Style Object
Client_Info
customObject
functions
UsingArrays
comments
concatenation
documentwrite
ifelse
Loops
forms
Strings
variables

 

 

On this page I will demonstrate how to create a simple form, in this case a feedback form with a submit button that will e-mail the data the user entered to an administrator.


Try to type in some feedback and then click submit. The data is submitted via E-mail Here is the code to create the form

// The function richardScript() is executed here

<script type="text/javascript">
<!-- Click Event for submit Feedback button
// richardScript function is defined here in head section of HTML

function richardScript()
{
feedbackForm.action = 'mailto:webmaster@cayemay.com';
}

//-->


Another script to execute richardScript function.

</script> <form name="feedbackForm" onsubmit="richardScript()">
<center>
<textarea cols="25" rows="7"></textarea><br>
<input type="submit" name="btnSubmit" value="Submit Feedback"></center>
</form>

Now try creating your own form by modifying my JavaScript to create your own.

 

This site was last updated 07/08/14