1/72
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What video files are supported
MP4 (mpeg4) WebM and OGG
codec H.264
remember this
What music files are supported
MP3 WAV and OGG
remember this
What image files are supported
jpeg, gif, svg, png, apng, png_ico, bmp, bmp_ico,
Apig gifts a savefile to 3 pinguins and is bumped twice
a
.a
#a
anchor tag
class ="a"
id="a"
remember this
how to track visitors IP address
Geolocation API
remember this
code to implement appCache for offline viewing
<html manifest="my-webpage.appcache">
remember the html tag with the manifest
remember this
Does js run client or server side
client
html comment
< ! ╌ text ╌>
css comment
/* text */
js comment
// text until the end of the line
Unassign a variable without deleting it
= undefined
a var can never truly be unset anymore
= delete is removing it completely
DOM is a representation of what code?
HTML
DOM is the concept of a web browser ...
API
DOM is made up from objects made in ... and modified with ...
HTML / JavaScript
Is DOM accessed by other tools like search engines or screen readers
yes
Is DOM the same as my HTML code
Yes and no, the browser can fix your html when things are missing during the DOM creation
document.querySelector(".cta a").style
is an example of:
css inline style application reviewed with a js call
remember this
if you want to change thru js, use the same code and add the color (or margin, padding, background collor etc)
document.querySelector(".cta a").style color = "green"
JavaScript uses what script standard
ECMAScript
Just remember the YMCA song and flip some letters
Geolocation API
location and ip
Pointer Events API
mouse movement tracking (hover or click)
Canvas API
var ctx = canvas.getContext('2d');
Draw graphics outside of the HTML code and the user can interact with.
Animation, game graphics, data visualization, photo manipulation, and real-time video processing
Drag and Drop API
A typical drag operation begins when a user selects a draggable element, drags the element to a droppable element, and then releases the dragged element.
It must have the attribute draggable set to true in the HTML
Drag/drop HTML code
Needs true or false does not work
remember this
get an element that has been marked as draggable
const draggableElement = document.getElementById('draggable-element');
add dragstart listener to the element
draggableElement.addEventListener('dragstart', onElementDragStart);
add drag data to the event
function onElementDragStart(event) {
event.dataTransfer.setData('text/plain', 'draggable-element');
}
History API
Controls the URL and lets navigational changes appear without reloading the page and bookmark the specific state without a individual url
aka use the browser back/forward buttons as navigation elements
history.pushState({page: 1}, 'Page One', '?page=1')
File System API
access to the local users file system even without uploading it. It can only read it, not update it.
input field email
looks like a text field but has validation properties
input field image
click on the picture to submit the form
input field search
like text but line breaks are removed when submitted
input field url
looks like text but has some validation
client side form validation vs server side
its a good practice to implement both. On the client side it helps to make the form more user friendly and faster, since a typo can be detected prior the form submission
built in form validation pros/cons
uses html form validation. best performance but less configuration
remember this
javaScript form validation pros/cons
slower than built in but more customizable
remember this
Form Validation
a
matches one character that is a (nothing else)
Form Validation
abc
matches abc. Not ab or abcd
Form Validation
ab?c
Matches ac or abc. The character in front of ? is optional
Form Validation
ab*c
matches a followed by any number of b and one c
abbbbbbbc
Form Validation
a|b
matches one character a or b but not ab
Form Validation
[Aa]pple
matches Apple or apple
remember this
Form input validation to follow a string (code line example) that has 4 valid inputs:
Banana, banana, Cherry, or cherry. Make sure you understand why only those four are valid.
<input id="choose" name="i-like" required pattern="[Bb]anana|[Cc]herry" />
<input ????="number"/>
type
what is <fieldset>
group several controls and labels within a web form. Regroup in semantic ways
<form>
<fieldset>
<legend></legend>
<input type="radio" id="S1" name="S1" value="S1">
<label for="S1">S1</label><br>
<input type="radio" id="S2" name="S2" value="S2">
<label for="S2">S2</label><br>
</fieldset>
</form>
what is <datalist>
Input form to give the user different options (dropdown list)
remember this
what is <keygen>
Create hidden keys for encryption within HTML using RSA. Not used anymore but still:
remember this
what is <output>
makes use of the FOR attribute in forms. Shows the value calculated by entries
remember this
How to set a string or node as the children of a element
Element.after()
i.e. a.after(span);
js code. () are after the element
remember this
Input validation
Phone number
pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}"
Input validation ipv4
pattern="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
do you see the difference between the phone example with [ ] and this example with \ to group the segments? Here I also used \d for any digits instead of [0-9]
remember this
Input validation country code (3 letter code like USA CAN GER)
pattern="[A-Za-z]{3}
pattern understanding
(?=^.{8,}$)
there are at least 8 characters. See the , after 8? That means 8 or infinity
?=look, ^=start with, .=any character, 8,= 8 or more, $=end
remember this
pattern understanding
(?=.*\d)
there is at least a digit
remember this
pattern understanding
(?=.*\W+)
there is one or more "non word" characters (\W is equivalent to [^a-zA-Z0-9_])
capitalization flips it to non. Like /D would be non digit
pattern understanding
(?![.\n])
there is no space or newline
!=no
remember this
pattern understanding
(?=.*[A-Z])
there is at least an upper case letter
remember this
pattern understanding
(?=.*[a-z])
there is at least a lower case letter
remember this
pattern understanding
.*$
in a string of any characters
comes at the end
pattern understanding bonus round
.
^
\d
\D
\s
x(?=y)
!
. matches any single character from class
^ negated [^ 0-8] looks for a 9
^ can also match the beginning of an input
\d any digit **
\D any character **
\s space
x(?=y) lookahead xy is valid but xz not **
! negative/not i.e x(?!y) xz is valid xy is not **
remember this **
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet
confused with ^?
^[^A]
/^A/
^[^A] looks for something that does not start with A
/^A/ looks for something that starts with A
+ vs *
+once or more
*0 or more
Event Handler section
What are event handlers
onClick, onFocus, onBlur etc. Describes the event happening when the user interacts with forms or input elements
remember this
form validation code example
<form name="myForm" action="/action_page.php" ***name and action (goes to new page)
onsubmit="return validateForm()" ***Event handler. remember the ()
method="post"> ***Post or get (how is is submitted) know the difference
Name: <input type="text" name="fname"> ***what is the input type, her its text
<input type="submit" value="Submit"></form> ***this is the submit type and the form close bracket
What is the event handler part of the code:
<INPUT TYPE="button" VALUE="Calculate" onClick="compute()">
onClick="compute()"
remember this
When the browser's width is 600px wide or less, hide the div element
@media screen and (max-width: 600px) {
div.example {
display: none;
It disapears when under the max width
remember this
What is AJAX?
Read webserver after its loaded
Update a web page without reloading
Send data to the server in the background
AsynchronusJavascriptAndXml
For example you click/hover over a button and new info appears without the page having to load. Think of a nav bar that drops down.
jQuery Syntax
.what(where)
$('#page-title').html('Page One');
$("ol").prepend("<li>Zero</li>");
append(element)
inserts the parameter element inside the element at the last index
prepend(element)
inserts the parameter element inside the element at the first index
before(element)
inserts the parameter element before the element
after(element)
inserts the parameter element after the element
remember this
Most important with cross browser compatibility
Function comes before style. Different browsers render things differently and may impact the usability.
GET vs POST
GET adds a string to the url (i.e search)
Post sends the form input data hidden