Basics Flashcards
form element
wraps a section of the document that contains form controls
action attribute
specifies the web address of a program that processes the information submitted via the form
method attribute
specifies the HTTP method that the browser should use to submit the form, such as POST or GET
- Create a form element
- Add an action attribute to the form element with the value “index.html”.
- Add a method attribute to the form element with the value “post”.
(form action=”index.html” method=”post”)
(/form)
input element
- used to create many different types of form controls
- SCT
type attribute
specifies what kind of form control should be rendered, such as text, email, passwords, and more
name attribute
submitted with form data so that server-side code can parse the information
- Inside the form element, add an input with the type attribute set to the value “text”.
- Add an id attribute with the value “name”.
- Add a name attribute to the input. Set its value to “user_name”.
(form action=”index.html” method=”post”)
(/form)
(form action=”index.html” method=”post”)
(input type=”text” id=”name” name=”user_name” /)
(/form)
textarea element
- accepts multiple lines of text from the user
- most browsers will render the textarea element with a widget to allow for resizing the editing area
- Inside the form element, add a textarea element
- Add an id attribute and set the value to “comment”.
- Add a name attribute and set the value to “user_comment”.
(form action=”index.html” method=”post”)
(/form)
(form action=”index.html” method=”post”)
(textarea id=”comment” name=”user_comment”)(/textarea)
(/form)
button element
- renders a clickable button
- the type attribute specifies whether the button should submit the form data, reset the form, or have no default behavior for use with JavaScript
- type=”reset”
- type=”button”
- Create a button element. Between the button tags, write the text “Submit Comment”.
- Add a type attribute with the value “submit”.
(button type=”submit”)Submit Comment(/button)