Quackit Logo

FREE Hosting!

With every domain name you register with ZappyHost, you get FREE hosting.

PLUS you get:

  • FREE Website Builder
  • FREE Blog
  • FREE Starter Web Page
  • FREE Email Account
  • & much more! (Total value $123 for FREE!)
Get your FREE hosting today! >>

Comment Box Code

Print Version

You can use the following HTML code to create a comment box within your HTML document.

Example Comment Box Code:

The following comment box code consists of a form containing a small textarea (the comment box) and an input field (the submit button). It also contains a break (<br />)after each element so that each form element starts on a new line.

This results in:

Comments:

Note that the above code assumes that there's an "action page" to process the contents of the form. In this example, "/html/tags/html_form_tag_action.cfm" is the server-side script that processes the form.

To learn more, check out the Add Comments to Website page.

Adding Color & Pictures

You can also change the color of your comment box, add borders, and add a background picture. Here are some examples:

Comments:

Change the color of your comment box


Add a background picture


Add borders to your comment box

Further Details

This info aims to help you understand the above code, which consists mainly of HTML tags (or HTML elements).

The form tags contain other tags nested within them. These other tags define the actual form elements that appear within the form - such as the actual comment box (otherwise known as the "textarea").

You can use the following template as a basis for your HTML comment box code. Simply fill in the blanks or remove uneeded attributes.

1. The <form> Tag

For an explanation of all the attributes, see the HTML form tag specifications.

<form
	action=""
	method=""
	enctype=""
	accept-charset=""
	accept=""
	name=""
	class=""
	id=""
	dir=""
	lang=""
	target=""
	onSubmit=""
	onReset=""
	onclick=""
	ondbclick=""
	onmousedown=""
	onmouseup=""
	onmouseover=""
	onmousemove=""
	onmouseout=""
	onkeypress=""
	onkeydown=""
	onkeyup="" >

	(the individual form element tags go here - see below)

	</form>

2. The <textarea> Tag

This tag defines the comment box within the form.

For an explanation of all the attributes, see the HTML textarea tag specifications.

<textarea
	name=""
	rows=""
	cols=""
	class=""
	id=""
	dir=""
	lang=""
	title=""
	style=""
	readonly=""
	disabled=""
	tabindex=""
	onfocus=""
	onblur=""
	onselect=""
	onchange=""
	onclick=""
	ondbclick=""
	onmousedown=""
	onmouseup=""
	onmouseover=""
	onmousemove=""
	onmouseout=""
	onkeypress=""
	onkeydown=""
	onkeyup="" >

	(this is where the user can type comments and stuff)

</textarea>

3. The <input> Tag

This tag defines input fields within the form and can be used for defining the submit button of the comment box.

For an explanation of all the attributes, see the HTML input tag specifications.

<input
	type=""
	name=""
	value=""
	size=""
	maxlength=""
	checked=""
	src=""
	class=""
	id=""
	dir=""
	lang=""
	title=""
	style=""
	align=""
	alt=""
	readonly=""
	disabled=""
	tabindex=""
	accesskey=""
	ismap=""
	usemap=""
	onfocus=""
	onblur=""
	onselect=""
	onchange=""
	onclick=""
	ondbclick=""
	onmousedown=""
	onmouseup=""
	onmouseover=""
	onmousemove=""
	onmouseout=""
	onkeypress=""
	onkeydown=""
	onkeyup="" />

Enjoy this website?

  1. Link to this page (copy/paste into your own website or blog):
  2. Add this page to your favorite social bookmarks sites:
                     
  3. Add this page to your Favorites

Oh, and thank you for supporting Quackit!