DJ Mike's Tutorials: Forms


^ >

Text Input, Password, Submit, Reset

Submit the form to see the
source code of the form.
Username:
Password


<input type="text" />

<input type="text"> gives an input box for short strings of text. A text input should have a name attribute. If the form's method is get, the name/value pair will be appended to the end of the URL after a question mark. Each name/value pair is separated by amperstands. If the form's method is post, you will not see the name/value pair. You can change the width of the box with the size attribute. Size is measured in number of characters. You can limit the number of characters that the use can enter into the box with the maxlength attribute. You can have text pre-entered into the box with the value attribute.

With webtv, you can add an attribute usestyle and the tags <font>, <b>, <i>, <u> and bgcolor will act on any form element but they will not show for computer users. For computer users, use CSS to style form elements. If you use a combination of CSS and Webtv attributes, you can make your form look close to the same for computer users and Webtv users: <b><u><input bgcolor="#aaaaff" usestyle type="text" style="color:red; font-size:20px; font-weight:800; font-style:italic; font-decoration:underline; background-color:#aaaaff" value="just some text"></u></b> .

Webtv has the attributes, border="0", nohighlight, autoactivate and nobackgroundthat do not work for computers. You can see what they do in the examples below.




For computers, you can use CSS to hide the border or give it a thick border: style="border: 0px ridge #ffffff"

<input type="password" />

<input type="password"> gives an input box like a text box but the characters are hidden. All the attributes are the same as they are for a text input.

<input type="submit" />

<input type="submit"> gives a your form a button that when clicked, submits the form's contents to the script. You can set the text on the submit button with the value attribute. If you don't the default text is Submit. With webtv, you can change the width of the button with a width attribute but it will not show on a computer. To change the width for computer users, use CSS: style="width:100px" .

<input type="reset" />

<input type="reset"> gives your form a button that when clicked, resets your form to it's initial state. It's attributes are the same as for a submit button. It's default text is Reset.

^ >


Was this webpage useful to you? You can support this website by donating.


Created by DJ Mike from Santa Barbara

DJ Mike


<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>