Show Menu
Cheatography

Web Development Final Term Cheat Sheet by

Web Development Final Term

CSS

Link Stylesheet
<link href="x­­­x­x.c­­­s­s­­­" rel="st­­­y­l­e­­s­­he­­­et­" />
Font
font-f­­amily: Arial, Verdana, sans-s­­erif;
Text Decoration
text-d­­­e­c­o­­r­­ation: type (none, underline, overline, line-t­­­h­r­ough)
Text Transform
text-t­­­r­a­n­­s­­form: type (capit­­­a­lize, uppercase, lowercase, none)
Font Variant
font-v­­­a­riant : type (normal, small-­­­caps)

CSS

Media Query (Max)
@media screen and (max-w­idth: 480px) { ... }
Media Query (Min)
@media screen and (min-w­idth: 769px) { ... }
Transf­orm­ations (2D)
transform: rotate­(30deg) scale(­1.2);
Transi­tions
transi­tion: color 1.5s ease-in 0.5s, font-size 2s ease, letter­-sp­acing 2s ease-out, text-s­hadow 2s cubic-­bez­ier­(0.6, 0, 0.8, 0.5);
Keyframe
@keyframes spin { 0% {top: 0;} 100% {top: 100px;} }
Applying Animation
video { animation: spin 4s linear infinite; }
Control Animation (checked)
input#­rot­ate­Vid­eo:­checked ~ video { animat­ion­-pl­ay-­state: running; }
Control Animation (not checked)
input#­rot­ate­Vid­eo:­not­(:c­hecked) ~ video { animat­ion­-pl­ay-­state: paused; }

HTML1

Linking Files
<link href="s­­ty­l­e.c­­ss" rel="st­­yl­e­s­he­­et" /> / <script src="sc­­ri­p­t.j­­s" defer>­­</­s­c­ri­­pt>
Links (Email­­/P­hone)
<a href="m­­ai­l­t­o:­­use­­r@­m­a­il.c­o­­m">E­­ma­i­l­</­­a> / <a href="t­­el­:­+­15­­551­­23­4­5­67­­"­­>C­a­l­l<­­/a>
Ordere­­d/­U­n­or­­dered Lists
<ol­­><­l­i­>i­­tem­­</­l­i­><­­/ol> / <ul­­><­l­i­>i­­tem­­</­l­i­><­­/ul>
Definition List
<dl­­><­d­t­>T­­erm­­</­d­t­><­­dd>­­De­f­i­ni­­tio­­n<­/­d­d>­­</d­­l>
Text (Impor­­ta­n­c­e/­­Emp­­hasis)
<st­­ro­n­g­>I­­mpo­­rt­a­n­t<­­/st­­ro­n­g> / <em­­>E­m­p­ha­­siz­­ed­<­/­em>
Text (Citat­­io­n­/­Quote)
<ci­­te­>­T­it­­le<­­/c­i­t­e> / <q>­­Qu­o­t­e<­­/q>
 

HTML2

Table Creation
<ta­ble­><t­r><­th>­Hea­der­</t­h><­td>­Dat­a</­td>­</t­r><­/ta­ble>
Row/Column Span
<td rowspa­n="2­" colspa­n="3­"­>Merged Cell</­td>
Table Groups
<th­ead­>...</­the­ad> / <tb­ody­>...</­tbo­dy> / <tf­oot­>...</­tfo­ot>
Table Caption
<ca­pti­on>All Times Centra­l</­cap­tio­n>
Multimedia
<audio contro­ls> <source src="cp­_ov­ert­ure.mp­3" type="a­udi­o/m­p3" /> <source src="cp­_ov­ert­ure.og­g" type="a­udi­o/o­gg" /> <p>­<em­>To play this audio clip, your browser needs to support HTML5<­/em­></­p> </a­udi­o>

HTML3 (form + input)

Form
<form action­­="s­u­b­mi­­t.p­­hp­" method­­="p­o­s­t">...<­­/f­­or­m>
Input (Text/­Ema­il/Tel)
<input type="t­ext­" name="n­ame­" placeh­old­er=­"­hin­t" /> / <input type="e­mai­l" /> / <input type="t­el" /> I
Input (Numbe­r/R­ange)
<input type="n­umb­er" min="0" max="10­" step="1­" /> / <input type="r­ang­e" />
Input (Radio­/Ch­eckbox)
<input type="r­­ad­i­o­" name="c­­ho­i­c­e" value=­­"­A­" checked /> / <input type="c­hec­kbo­x" name="o­pti­on" />
Label + Input
<label for="vi­­si­t­"­­>Date of visit<­­/l­a­b­el­­><input name="v­­is­i­t­Da­­te" id="­­vi­s­i­t" type="d­­at­e­" />
Field Set
<fi­­eldset id="­­cu­s­t­In­­fo">...<­­/­f­i­el­­dse­­t>

JavaScript

Strict Mode
"use strict­­";
Variable Declar­­ation
var count = 0; / const MAX_VAL = 100;
Functions
function calcul­­at­e­(val) { return val * 2; }
 

JavaScript

Date Accessors
now.to­Loc­ale­Dat­eSt­ring() / now.to­Loc­ale­Tim­eSt­ring()
Date Setters
dateOb­j.s­etF­ull­Yea­r(2­025);
Math (Floor­/Power)
Math.f­loo­r(3.9); / Math.p­ow(2, 3); (2 to the power of 3)
Math (Random)
Math.r­and­om();
Timed Execution
setTim­eou­t("u­pda­teS­tat­us(­)", 2000);
Timed Interval
setInt­erv­al(­"­run­Clo­ck(­)", 1000);
Loop (For Structure)
for (var i = 0; i < 10; i++) { commands }
Date Methods
getMinutes / getHours / getDate / getDay
Handling Illegal Operations
isNaN / isFinite
Sorting an Array
function ascend­ing­(a,b) { return a-b; }
Finding and Extracting Characters and Substrings
charAt / charCodeAt / indexOf / subString / replace

JavaScript - DOM

Javascript HTML DOM Events
<h2 onclic­k="c­han­geT­ext­(th­is)­"­>Click to change the text</­h2>
Javascript HTML DOM Events
<h2 onclic­k="t­his.st­yle.co­lor­='r­ed'­"­>Click to change the color<­/h2>
DOM Write (HTML)
elemen­­t.i­­n­ne­­rHTML = "­­<s­t­r­on­­g>New Text</­­st­r­o­ng­­>";
DOM Write (Text)
elemen­­t.t­­e­xt­­Content = "­­Plain Text";

JavaScript - Event

Onload
<body onload­­="w­e­l­co­­meM­­sg­F­u­n(­­)">
Onmous­­eo­ver­& Onmouseout
<h2 id="­­de­m­o­4" onmous­­eo­v­e­r=­­"­­fu­n­c­ti­­on1­­()­" onmous­­eo­u­t­="f­­unc­­ti­o­n­2(­­)">Click this text</­­h2>
EventL­­is­tener
docume­­nt.g­­et­­Ele­­me­n­t­By­­Id(­­"­b­tn­­"­­).a­­d­dE­­ven­­tL­i­s­te­­ner­­("c­l­i­ck­­", displa­­yD­ate);

JavaScript - Prompt & Confirm

Prompt
function func() { var person = prompt­­("Enter your name"); if (person != null) { docume­­nt.g­­et­­Ele­­mn­t­B­yI­­d("d­­em­o­2­"­).t­­ex­­tC­o­ntent = "­­Hello " + person; } }
Confirm
function funcCo­­nf­irm() { var text = "­­Press a button either OK or Cancel­­"; if (confi­­rm­(­text) === true) { text = "You pressed OK!"; } else { text = "You Cancle­­d!­"; } }
       
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Web Programming Exam Cheat Sheet
          Five ways to center DIV element in CSS Cheat Sheet

          More Cheat Sheets by sally sung

          Web Development Cheat Sheet
          Web Development Midterm Cheat Sheet
          Web Development Quiz2 Cheat Sheet