Javascript: A simple form

This entry is part 18 of 27 in the series Javascript Tutorial

A simple textbox input form.

<!DOCTYPE html>
    <title>Test input</title>
        function submitForm(form) {
            var text_input = form.inputbox.value;
<form>Enter something in the box: <br><br>
    <input type="text" name="inputbox" value=""><P>
        <input type="button" name="button" value="Click" onClick="submitForm(this.form)">
<p id="text_id">You typed</p>
Take note of how the text you typed into the text box is passed into variable text_input.
var text_input = form.inputbox.value;
Series Navigation<< Javascript: Array
Javascript: Form with radio buttons >>

Leave a comment

Leave a Reply