reading-notes

reading notes for code fellows


Project maintained by dLeigh01 Hosted on GitHub Pages — Theme by mattgraham

Forms and JS Events

Forms

forms allow users to perform many functions online, such as registeration, and shopping.

there are several form controls useable to collect information from users.

how forms work: a user submits information to the server, the name of each form control and its data is processed by the server, the server creates a new page to send back based on the registered info. To differentiate between data, all the info is sent using name/value pairs, ex username=dana. If the value is text, it will be whatever the user types, if the value is an option, it will be assigned based on whatever the user chose.

a form is created with the <form> element and an action attribute containing the URL for the page on the server recieving information from the form. It will be sent using either the get (values are added to the end of the URL, ideal for short forms) or post (sent as HTTP headers, good for if the user needs to submit a file or the form is long/contains sensitive data) method attribute. If not method, the id attribute is used to differentiate the data in the form from the rest of the page.

Lists Tables and Forms

list-style-type allows you to conrol the shape and style of a bullet point.

list-style-image url("#") allows you to specify an image to act as a bullet point.

list-style-position allows you to either put the marker outside or inside your block of text.

table properties:

if you have empty cells, you can use empty-cells to specify whether or not their borders should be shown

you can specify whether there should be gaps between cells using border-spacing and border-collapse

an easy way to ensure your inputs line up is to use <label> to give them names, then float the names to the left and give them a fixed width so their input boxes will start in the same place.

cursor allows you to control how the cursor is displayed to users/

Events

event types:

when an event has occured it has fired or been raised, these events will trigger scripts or functions

when a user interacts with HTML it has three steps (known as event handling) to trigger JavaScript code

three ways to bind an event to an element

event flow

event object tells you about the event and the element it happened upon

the event object has changing methods the default behavior of an element and how its ancestors respond to the event

[< table of contents]

[< home]