reading-notes

Forms and Events

Forms

An HTML form is used to collect user input. The user input is most often sent to a server for processing.

refers to a printed document that contains spaces for you to fill in information.

form

### Form Controls to add text:

### Form Structure 1.The / Element 2.The / Element

form


Lists, Tables and Forms

Lists 1.Bullet Point Styles list-style-type
2.Images for Bullets list-style-image 3.Positioning the Marker list-style-position 4.List Shorthand list-style

Styling Forms 1.Styling Input Fields Use the width property to determine the width of the input field 2.Padded Inputs Use the padding property to add space inside the text field. 3.Bordered Inputs Use the border property to change the border size and color, and use the border-radius property to add rounded corners 4.Colored Inputs Use the background-color property to add a background color to the input, and the color property to change the text color 5.Input with icon/image If you want an icon inside the input, use the background-image property and position it with the background-position property. Also notice that we add a large left padding to reserve the space of the icon

styling


Events

HTML events are “things” that happen to HTML elements. When JavaScript is used in HTML pages, JavaScript can “react” on these events.

An HTML event can be something the browser does, or something a user does.

event

Here are some examples of HTML events:

Often, when events happen, you may want to do something. JavaScript lets you execute code when events are detected. HTML allows event handler attributes, with JavaScript code, to be added to HTML elements.

Here is a list of some common HTML events:

Event Description
onchange An HTML element has been changed
onclick The user clicks an HTML element
onmouseover The user moves the mouse over an HTML element
onmouseout The user moves the mouse away from an HTML element
onkeydown The user pushes a keyboard key
onload The browser has finished loading the page