Skip to content

Forms in HTML

Forms in HTML

Tag

Attribute

Meaning

form

A tag that contains any of the following tags, making them into a valid HTML form

action

The name of the server-side CGI that is run when control is pased back to the Web server

input

A form field of varying types, depending on the value of the type attribute

class

The class assigned to the element

id

The unique id assigned to the element; as with JavaScript objects, no spaces or punctuation marks are allowed, and the id cannot start with a nuber

name

Primarily used to group sets of radio buttons

maxlength

The maximum length entry that the user may enter in this field

size

The number of characters that are displayed on the page

type

The type of input required; possible values include button, checkbox, image, password, radio, reset, submit, and text

value

The preset value of this form field

label

Used to specify labels for controls that do not have build-in labels, such as text fields, check boxes, radio buttons, and menus

for

Associates the label with a specific element's id

option

The possible options available inside a select tag

selected

Indicates whether this option is selected as the default

value

The preset value of each option

select

A form field that is either a pop-up menu or a scrolling list, based on the size attribute

class

The class assigned to the element

id

The unique id assigned to the element

size

The number of options that are displayed on the page; if the attribute is set to 1, or this attribute is not present, the result is a pop-up menu

Reference: JavaScript Visual QuickStart Guide, 8th Edition

天上的神明与星辰,人间的艺术和真纯,我们所敬畏和热爱的,莫过于此。