CLASS-09
HTML FORMS
Forms allows us to collect information from visitors to our site.
FORM CONTROLS
- Adding Text:
- Text input (single-line)
- Password input
- Text area (multi-line)
- Making Choices:
- Radio Buttons
- Checkboxes
- Drop-down boxes
- Submitting Forms:
- Submit Buttons
- Image buttons
- File upload
Forms send the information to the servers in name/value pairs.
We use the following elements:
<form>
Controls live inside.<action>
Its value is the URL for the page on the server that will receive the information.<method>
It should beget
orpost.
<input>
It creates several controls. (needstype
name
and their values.)<textarea>
Creates multi-line text.<select>
Creates drop down list box.<option>
Specifies the options in the drop down list.<button>
Creates a button.<label>
Makes the form accessible to vision-impaired users.<fieldset>
Groups related form controls together.<legend>
Used after<fieldset>
and contains a caption to identify the purpose of that group.
CSS LISTS, TABLES AND FORMS
- Bullet Point Styles: We use the
list-style
property. - Image For Bullets: We use the
list-style-image
property and the value starts with aurl.
- Positioning The Marker: We use the
list-style-position
property. - Table Properties: width, padding, text-transform, letter-spacing, font-size, border-top, border-bottom, text-align, background-color, :hover.
- Border Empty Cells: We use the
empty-cells
property. - Cursor Styles: We use the
cursor
property.
JAVASCRIPT EVENTS
Browsers register different types of events that make the script respond by updating the page via DOM:
- User interactions create events.
- Events trigger code.
- Code respond to users.
- When events occur is described as being fired or raised.
- Events trigger a function or script.
TYPES OF EVENTS
- UI Events: When users interact with the browser.
- Keyboard Events: When users interact with the keyboard.
- Mouse Events: When users interact with the mouse.
- Focus Events: When an element gains or loses focus.
- Form Events: When users interact with a form element.
- Mutation Events: When the DOM structure has been changed by a script.
EVENT HANDLING: Refers to the user interaction with the html of a page involving three steps that trigger the code:
- Select the element node(s) we want the script to respond to.
- Indicate which event on the selected node(s) will trigger the response. Also known as binding.
- State the code we want to run.
WAYS TO BIND AN EVENT TO AN ELEMENT
- HTML Event Handlers: It is bad practice now days. May find it in older code.
- Event Handlers: Triggers a single function.
- Event Listeners: Triggers multiple functions.
EVENT FLOW
HTML Elements nest inside other elements. If you click on a link you will also be clicking on its parents elements.
- Event Bubbling: The event starts at the most specific node and flows outwards to the least specific.
- Event Capturing: The event starts at the least specific node and flows inwards to the most specific.
DELEGATION: It can be used to monitor for events that happen on all of the children of an element.
Things I want to know more about
- The complexities of Event Handling.