Reading Notes
Forms allow you to collection information from the user
<form action="URL" method="get"><p>This is where the form controls will appear.</p></from>
action
links to the page the page on the server that will receive the informationmethod
can use get
or post
, get better for short forms and nonsensitive info, post better for the otherid
used to identify the form specifically from other elementssize
old tag no longer used, specifies the width of text input boxes in character widths<input type="text" name="username" size="15" maxlength="30"/>
type="text"
creates single line text inputname
identifies the form controlmaxlength
sets a maximum number of characters that can be entered into the text boxtype="password"
acts like a single line text box, but characters are blocked out
-<textarea>Enter text prompt here...</textarea>
element used to create a multi-line text inputtype="radio"
allows user to pick one of a number of itemsvalue="example"
contains the value that should be sent to the server when selectedchecked
indicates which radio button should be preselected on page loadtype="checkbox"
allow user to select one or more answers to a question<select><option value="example1>Example 1</option></select>
select tag creates drop down menu, option tags create each menu option<input type="file"/>
creates a text window with a browse… button for uploading a filetype="submit"
used to send form to servertype="image"
allows you to use an image as the submit button<button></button>
can combine images and text between the tags to influence button appearancetype="hidden"
allow page authors to add values to forms that users cannot see<label></label>
used to label form fields<fieldset></fieldset>
groups form items together<legend>
caption for the fieldset that indicates info about group of form itemsplaceholder="example"
any text input allows the use of placeholder
which puts temp text in the input box on page load, disappears when user clicks on itBullet Point Styling
{ list-style-type: ;}
can be applied to <ol>
<ul>
<li>
items
ul{list-style-image: url("images/example.png");}
allows author to set image as bullet point{list-style-position: ;}
default is outside
can be set to inside
which would bring the point inside of the text box{list-style: inside circle;}
Table Properties
width
sets width of tablepadding
sets space between content and bordertext-transformation
convert content of table headers to uppercaseletter-spacing, font-size
to add additional styling to the content of the table headersborder-top, border-bottom
to set borders above and below table headerstext-align
align text left, center, or rightbackground-color
use to change the background color of rows or cells:hover
highlight a table row when a user’s mouse goes over itshow
, hide
, or inherit
controls cell borders on empty cellscollapse
pushes cells together and merges their borders to a single widthseparate
puts margin between cellsForm Styling
font-size
controls font size of entered textcolor
sets text colorbackground-color
sets input box background colorborder-radius
rounds the corners of an input box:focus
pseudo-class used to change the color of the input box when it is being used:hover
pseudo-class applies styles when hover over input boxbackground-image
adds background image to the input boxCursor Styles
{cursor: example;}
makes the cursor show up with a specific style or image when located above a specific element
auto
, crosshair
, default
, pointer
, move
, text
, wait
, help
, url("cursor.gif")
How events trigger JS code
Event Handlers
Traditional DOM Event Handler
function checkUsername() {
//code to check the length of username
}
var el = document.getElementByID('username');
el.onblur = checkUsername;
Event Listener
element.addEventListener('event', functionName [,Boolean]);
element
DOM element node to targetaddEventListener('event, functionName [, Boolean]);
Method, adds an event listener to the DOM element nodeevent
event to bind nodes tofunctionName
name of function to call[, Boolean]
indicates something called capture and is usually set to false
Event Bubbling *event starts at the most specific node and flows outwards towards the least specific
Types of Events
User Interface Events
load
fires when the page has finished loading or other specific nodes that finish loadingunload
fires when the webpage is unloadingerror
fires when browser encounters a javascript error or an asset that is missingresize
fires when teh browser window has been resizedscroll
fires when the user scrolls up or downFocus and Blur Events
focus
when an element gains focus, focus event fires for that DOM nodeblur
when an element loses focus, the blur event fires for that nodefocusin
same as focus except not supported on firefoxfocusout
same as blur except not supported on firefox