HTML Textbox Code
This page contains HTML textbox code. Feel free to copy and paste the HTML textbox code into your own website, blog, MySpace page, or other HTML document. And feel free to modify the code as you wish.
Basic HTML Textbox Code
To create an HTML textbox, you use the
textarea tag and specify how many columns wide and how many rows high the textbox should be.
Here's an example:
Textbox That Actually DOES Something
OK, the above code is all well and good. But, the texbox doesn't actually do anything (other than display text).
To make the textbox actually do something (well, something worthwhile), it needs to be submitted to an action page. This action page provides the programming logic to process the form data. In the example below, we nest the
textarea within a
form tag that specifies an action page using the
Programming an action page can be quite complex and is outside the scope of this article. But if you want to create a textbox that allows the user to send a message to your email, check out this form to email script.
Readonly Textbox Code
Not all textboxes need to submit to an action page for processing. If you prefer, you can create a "read only" textbox.
With a read-only texbox, you can use your textbox to display text, but users won't be able to change the value. They can still submit the contents using a submit button, but they just can't change the value.
To make your HTML textbox read-only, add the
readonly attribute (eg
Disabled Textbox Code
You can also create a disabled textbox. A disabled textbox will prevent the user from selecting any value in the textbox, and its value won't be submitted when the form is submitted.
To disable your HTML textbox, add the
disabled attribute (eg
HTML Textbox Titles
You can add titles to your textboxes. Titles are like little tool tips that appear when the user hovers over the textbox.
To add a title to your textbox, add the
title attribute (eg
title="Type your message here...").
More Textbox Codes
You can do much more with textboxes. Below are links to pages that provide HTML code for different effects you can do with textboxes: