javascript

JavaScript (officially named ECMAScript) is a client side scripting language used to add interactivity to web pages. It is an interpreted programming language which means it is not compiled before it is executed.

Javascript Operators

OperatorDescription
+addition
-subtraction
*multiplication
/division
%modulus (division remainder)
++increment
--decrement
==equal to
===exactly equal to (value and type)
!=not equal to
>greater than
<less than
>=greater than or equal to
<=less than or equal to
&&and
||or
!not
:conditonal assignment

Javascript Keywords

The following is a list of words that have a predetermined definition and use in Javscript. These words should not be used when declaring variables or custom identifiers to avoid scripting errors.

  1. break
  2. case
  3. catch
  4. continue
  5. default
  6. delete
  7. do
  8. else
  9. finally
  10. for
  11. function
  12. if
  13. in
  14. instanceof
  15. new
  16. return
  17. switch
  18. this
  19. throw
  20. try
  21. typeof
  22. var
  23. void
  24. while
  25. with

These words are not keywords, but are still reserved for possible future use in Javascipt.

  1. abstract
  2. boolean
  3. byte
  4. char
  5. class
  6. const
  7. debugger
  8. double
  9. enum
  10. export
  11. extends
  12. final
  13. float
  14. goto
  15. implements
  16. import
  17. int
  18. interface
  19. long
  20. native
  21. package
  22. private
  23. protected
  24. public
  25. short
  26. static
  27. super
  28. synchronized
  29. throws
  30. transient
  31. volatile
 

getURLparam Function

Here is a nice little script that parses the window.location.href value and returns the value for the parameter you specify using javascript's built in regular expressions. Thank you Justin Barlow at Netlobo.

Example URL query:
http://www.website.com/index.html?num=123&char=abc
getURLparam('num'); returns the value '123'
getURLparam('char'); return the value 'abc'

function getURLparam(name){
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp(regexS);
  var results = regex.exec(window.location.href);
  if(results == null)
    return "";
  else
    return results[1];
}

getElementsByClass Function

For some reason, there is no DOM method in JavaScript for grabbing elements by a className. We have getElementById, getElementsByName and getElementsByTagName, so how come there is no getElementsByClass? I'm sure it will be added in the future, but until then here is a great function written by Dustin Diaz.

function getElementsByClass(searchClass,node,tag){
  var classElements = new Array();
  if (node == null)
    node = document;
  if (tag == null)
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++){
    if (pattern.test(els[i].className)){
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}

document object model [dom]

The DOM is a language-neutral platform that defines the objects and properties of all elements in a document and provides the methods (interface) to access and manipulate them. The DOM presents a document as a tree structure consisting of nodes; everything in a document is a node.

                       Document
                          |
                  Root Element:<html>
                 /                   \
         Element:<head>         Element:<body>
        /                      /              \
Element:<title>        Element:<h1>      Element:<a> - Attribute:"href"
       |                    |                 |
  Text:"Title"        Text:"Heading"     Text:"Link"

Properties

 

PropertyDescription
  

Methods

 

MethodDescription
  

hypertext markup language [html]

HTML is a markup language that describes web pages. An HTML document is also called a web page.

Basics

Tags

  • Tags are the basic building blocks of HTML.
  • Tags are used by the browser to interpret the content of the page.

Elements

  • An element starts with an opening tag and ends with closing tag.
  • The element content is everything between the opening and closing tags.
  • Some elements have empty content, these are closed in the opening tag (self closing).

Attributes

  • Attributes provide additional information about elements.
  • Attributes are always defined in the opening tag.
  • Attributes come in name/value pairs

Example

 _____________________html element_____________________
|                                                      |
 opening tag     attribute      content    closing tag
            \       |              |      /
             <a href="index.html">home</a>
                 |        |
      attribute name    value

Tag List

Complete tag list, highlighted tags are either new in HTML5 or deprecated.

TagDescription
<!-- -->comments inside of code, ignored by browser
<!DOCTYPE>not actually a tag, tells the browser which HTML specification the document uses, must be placed before <html> tag
<a>hyperlink
<abbr>abbreviation or acronym
<acronym>use the <abbr> tag instead
<address>contact information for the author or owner of a document
<applet>use the <object> tag instead
<area>area inside of an image map, always nested inside a <map> tag
<article>external content, independent from the rest of the document
<aside>related to the surrounding content
<audio>sound, music or other audio streams
<b>bold text
<base>default URL, and/or a default target, for all elements containing a URL, must be inside the <head> element
<basefont>default font-color, font-size, or font-family for all text, use styles instead
<bdo>bidirectional override or direction of the text
<big>bigger text, use styles instead
<blockquote>long quotation block from another source
<body>contains all content of a document
<br>single line break
<button>push button, can contain content, always spedify the type attribute
<canvas>graphics container, script must be used to display graphics
<caption>table caption, must be immediately after the <table> tag
<center>center align content, use styles instead
<cite>citation
<code>computer code
<col>attributes for table columns, instead of repeating styles for each cell on each row
<colgroup>attributes for groups of table columns
<command>command button, only visible if inside a <menu> element
<datalist>available options for an <input> element, not visible
<dd>description of an item in a definition list
<del>deleted text
<details>details about document or parts of a document, not visible by default
<dfn>definition term
<dir>directory list, us the <ul> tag instead
<div>division of a document, used to group and format other elements
<dl>definition list
<dt>item or term in a definition list
<em>emphasized text
<embed>external interactive content or plugin
<fieldset>groups elements inside a form
<figcaption>caption of a <figure> element
<figure>groups stand-alone content used to explain parts of a document
<font>font face, font size, and font color, use styles instead
<footer>footer of a document
<form>element for user input to pass data to a server
<frame>particular window or frame within a frameset, bad for usability
<frameset>organizes multiple windows or frames, bad for usability
<h1> to <h6>headings, <h1> is largest or most important
<head>information about the document, container for head elements
<header>introduction to the document
<hgroup>group of headings
<hr>horizontal rule
<html>defines document as HTML, outermost/root element
<i>italic text
<iframe>inline frame containing another document
<img>image
<input>input field for user data
<ins>inserted text
<keygen>generated key in a form
<kbd>keyboard text
<label>label for a form control
<legend>caption for <fieldset>, <figure> or <details> elements
<li>list item
<link>defines relationship between a document and an external resource
<map>image map
<mark>marked text
<menu>list or menu of commands
<meta>provides information about the document, always goes insode the <head> element
<meter>measurements within a predetermined range
<nav>a section of navigation
<noframes>text for browsers that don't support frames
<noscript>alternate content for browsers without script support or scripts disabled
<object>embeds external objects in a document
<ol>ordered (numbered) list
<optgroup>groups related options in a drop-down list
<option>defines values of a <select> of <datalist> element
<output>result of a calculation
<p>paragraph
<param>parameters or variables for <object> elements
<pre>preformatted text, preserves spaces and line breaks
<progress>displays progress of a task or function
<q>short quotation
<rp>what to show if a browser does not support the ruby element
<rt>explanation or pronunciation of characters
<ruby>ruby annotation, for East Asian typography
<s>text that is no longer correct, accurate or relevant
<samp>sample computer code
<script>defines a client-side script
<section>sections of a document
<select>creates a selectable drop-down list
<small>small text
<source>resources for media elements, such as <video> and <audio>.
<span>groups inline elements
<strike>strikethrough text
<strong>strong text
<style>style definitions
<sub>subscripted text
<summary>header for <details> element
<sup>superscripted text
<table>table
<tbody>table body
<td>standard cell in a table
<textarea>defines a multi-line text input control
<tfoot>groups the footer content in a table
<th>header cell in a table
<thead>groups the header content in a table
<time>defines date, time or both
<title>document title
<tr>table row
<tt>teletype text
<u>underlined text
<ul>unordered (bulleted) list
<var>variable
<video>video
<wbr>defines where in a word it would be ok to add a line-break
<xmp>preformatted text

Character Entities

Here is a reference table of all special characters and their corresponding codes.

CharacterNumberNameDescription
"&#34;&quot;quotation mark
'&#39;&apos;apostrophe
&&#38;&amp;ampersand
<&#60;&lt;less-than
>&#62;&gt;greater-than
 &#160;&nbsp;non-breaking space
¡&#161;&iexcl;inverted exclamation mark
¢&#162;&cent;cent
£&#163;&pound;pound
¤&#164;&curren;currency
¥&#165;&yen;yen
¦&#166;&brvbar;broken vertical bar
§&#167;&sect;section
¨&#168;&uml;spacing diaeresis
©&#169;&copy;copyright
ª&#170;&ordf;feminine ordinal indicator
«&#171;&laquo;left angle quotation
¬&#172;&not;negation
­&#173;&shy;soft hyphen
®&#174;&reg;registered trademark
¯&#175;&macr;spacing macron
°&#176;&deg;degree
±&#177;&plusmn;plus-or-minus
²&#178;&sup2;superscript 2
³&#179;&sup3;superscript 3
´&#180;&acute;spacing acute
µ&#181;&micro;micro
&#182;&para;paragraph
·&#183;&middot;middle dot
¸&#184;&cedil;spacing cedilla
¹&#185;&sup1;superscript 1
º&#186;&ordm;masculine ordinal indicator
»&#187;&raquo;right angle quotation
¼&#188;&frac14;fraction 1/4
½&#189;&frac12;fraction 1/2
¾&#190;&frac34;fraction 3/4
¿&#191;&iquest;inverted question mark
À&#192;&Agrave;capital a, grave accent
Á&#193;&Aacute;capital a, acute accent
Â&#194;&Acirc;capital a, circumflex accent
Ã&#195;&Atilde;capital a, tilde
Ä&#196;&Auml;capital a, umlaut mark
Å&#197;&Aring;capital a, ring
Æ&#198;&AElig;capital ae
Ç&#199;&Ccedil;capital c, cedilla
È&#200;&Egrave;capital e, grave accent
É&#201;&Eacute;capital e, acute accent
Ê&#202;&Ecirc;capital e, circumflex accent
Ë&#203;&Euml;capital e, umlaut mark
Ì&#204;&Igrave;capital i, grave accent
Í&#205;&Iacute;capital i, acute accent
Î&#206;&Icirc;capital i, circumflex accent
Ï&#207;&Iuml;capital i, umlaut mark
Ð&#208;&ETH;capital eth, Icelandic
Ñ&#209;&Ntilde;capital n, tilde
Ò&#210;&Ograve;capital o, grave accent
Ó&#211;&Oacute;capital o, acute accent
Ô&#212;&Ocirc;capital o, circumflex accent
Õ&#213;&Otilde;capital o, tilde
Ö&#214;&Ouml;capital o, umlaut mark
×&#215;&times;multiplication
Ø&#216;&Oslash;capital o, slash
Ù&#217;&Ugrave;capital u, grave accent
Ú&#218;&Uacute;capital u, acute accent
Û&#219;&Ucirc;capital u, circumflex accent
Ü&#220;&Uuml;capital u, umlaut mark
Ý&#221;&Yacute;capital y, acute accent
Þ&#222;&THORN;capital THORN, Icelandic
ß&#223;&szlig;small sharp s, German
à&#224;&agrave;small a, grave accent
á&#225;&aacute;small a, acute accent
â&#226;&acirc;small a, circumflex accent
ã&#227;&atilde;small a, tilde
ä&#228;&auml;small a, umlaut mark
å&#229;&aring;small a, ring
æ&#230;&aelig;small ae
ç&#231;&ccedil;small c, cedilla
è&#232;&egrave;small e, grave accent
é&#233;&eacute;small e, acute accent
ê&#234;&ecirc;small e, circumflex accent
ë&#235;&euml;small e, umlaut mark
ì&#236;&igrave;small i, grave accent
í&#237;&iacute;small i, acute accent
î&#238;&icirc;small i, circumflex accent
ï&#239;&iuml;small i, umlaut mark
ð&#240;&eth;small eth, Icelandic
ñ&#241;&ntilde;small n, tilde
ò&#242;&ograve;small o, grave accent
ó&#243;&oacute;small o, acute accent
ô&#244;&ocirc;small o, circumflex accent
õ&#245;&otilde;small o, tilde
ö&#246;&ouml;small o, umlaut mark
÷&#247;&divide;division
ø&#248;&oslash;small o, slash
ù&#249;&ugrave;small u, grave accent
ú&#250;&uacute;small u, acute accent
û&#251;&ucirc;small u, circumflex accent
ü&#252;&uuml;small u, umlaut mark
ý&#253;&yacute;small y, acute accent
þ&#254;&thorn;small thorn, Icelandic
ÿ&#255;&yuml;small y, umlaut mark
Œ&#338;&OElig;capital ligature OE
œ&#339;&oelig;small ligature oe
Š&#352;&Scaron;capital S with caron
š&#353;&scaron;small S with caron
Ÿ&#376;&Yuml;capital Y with diaeres
ƒ&#402;&fnof;f with hook
ˆ&#710;&circ;modifier letter circumflex
˜&#732;&tilde;small tilde
Α&#913;&Alpha;Alpha
Β&#914;&Beta;Beta
Γ&#915;&Gamma;Gamma
Δ&#916;&Delta;Delta
Ε&#917;&Epsilon;Epsilon
Ζ&#918;&Zeta;Zeta
Η&#919;&Eta;Eta
Θ&#920;&Theta;Theta
Ι&#921;&Iota;Iota
Κ&#922;&Kappa;Kappa
Λ&#923;&Lambda;Lambda
Μ&#924;&Mu;Mu
Ν&#925;&Nu;Nu
Ξ&#926;&Xi;Xi
Ο&#927;&Omicron;Omicron
Π&#928;&Pi;Pi
Ρ&#929;&Rho;Rho
Σ&#931;&Sigma;Sigma
Τ&#932;&Tau;Tau
Υ&#933;&Upsilon;Upsilon
Φ&#934;&Phi;Phi
Χ&#935;&Chi;Chi
Ψ&#936;&Psi;Psi
Ω&#937;&Omega;Omega
α&#945;&alpha;alpha
β&#946;&beta;beta
γ&#947;&gamma;gamma
δ&#948;&delta;delta
ε&#949;&epsilon;epsilon
ζ&#950;&zeta;zeta
η&#951;&eta;eta
θ&#952;&theta;theta
ι&#953;&iota;iota
κ&#954;&kappa;kappa
λ&#955;&lambda;lambda
μ&#956;&mu;mu
ν&#957;&nu;nu
ξ&#958;&xi;xi
ο&#959;&omicron;omicron
π&#960;&pi;pi
ρ&#961;&rho;rho
ς&#962;&sigmaf;sigmaf
σ&#963;&sigma;sigma
τ&#964;&tau;tau
υ&#965;&upsilon;upsilon
φ&#966;&phi;phi
χ&#967;&chi;chi
ψ&#968;&psi;psi
ω&#969;&omega;omega
ϑ&#977;&thetasym;theta symbol
ϒ&#978;&upsih;upsilon symbol
ϖ&#982;&piv;pi symbol
&#8194;&ensp;en space
&#8195;&emsp;em space
&#8201;&thinsp;thin space
&#8204;&zwnj;zero width non-joiner
&#8205;&zwj;zero width joiner
&#8206;&lrm;left-to-right mark
&#8207;&rlm;right-to-left mark
&#8211;&ndash;en dash
&#8212;&mdash;em dash
&#8216;&lsquo;left single quotation
&#8217;&rsquo;right single quotation
&#8218;&sbquo;single low-9 quotation
&#8220;&ldquo;left double quotation
&#8221;&rdquo;right double quotation
&#8222;&bdquo;double low-9 quotation
&#8224;&dagger;dagger
&#8225;&Dagger;double dagger
&#8226;&bull;bullet
&#8230;&hellip;horizontal ellipsis
&#8240;&permil;per mille
&#8242;&prime;minutes
&#8243;&Prime;seconds
&#8249;&lsaquo;single left angle quotation
&#8250;&rsaquo;single right angle quotation
&#8254;&oline;overline
&#8364;&euro;euro
&#8482;&trade;trademark
&#8592;&larr;left arrow
&#8593;&uarr;up arrow
&#8594;&rarr;right arrow
&#8595;&darr;down arrow
&#8596;&harr;left right arrow
&#8629;&crarr;carriage return arrow
&#8704;&forall;for all
&#8706;&part;part
&#8707;&exist;exists
&#8709;&empty;empty
&#8711;&nabla;nabla
&#8712;&isin;isin
&#8713;&notin;notin
&#8715;&ni;ni
&#8719;&prod;prod
&#8721;&sum;sum
&#8722;&minus;minus
&#8727;&lowast;lowast
&#8730;&radic;square root
&#8733;&prop;proportional to
&#8734;&infin;infinity
&#8736;&ang;angle
&#8743;&and;and
&#8744;&or;or
&#8745;&cap;cap
&#8746;&cup;cup
&#8747;&int;integral
&#8756;&there4;therefore
&#8764;&sim;similar to
&#8773;&cong;congruent to
&#8776;&asymp;almost equal
&#8800;&ne;not equal
&#8801;&equiv;equivalent
&#8804;&le;less or equal
&#8805;&ge;greater or equal
&#8834;&sub;subset of
&#8835;&sup;superset of
&#8836;&nsub;not subset of
&#8838;&sube;subset or equal
&#8839;&supe;superset or equal
&#8853;&oplus;circled plus
&#8855;&otimes;cirled times
&#8869;&perp;perpendicular
&#8901;&sdot;dot operator
&#8968;&lceil;left ceiling
&#8969;&rceil;right ceiling
&#8970;&lfloor;left floor
&#8971;&rfloor;right floor
&#9674;&loz;lozenge
&#9824;&spades;spade
&#9827;&clubs;club
&#9829;&hearts;heart
&#9830;&diams;diamond

cascading style sheets [css]

Basics

Syntax

Example

selector        declaration
        \           |
         h1 {color:purple;} /* comment */
              /         \
         property      value

Measurement Values

There are several options to choose from when defining the size of an element or font. You should pick the proper units for your intended application. When designing for the screen you will most commonly use px, % and em.

UnitsDescription
%percentage
pxpixels, 1px equals 1 dot on a computer screen
emems are proportional to a user’s set font size, 1em equals the current font size, 2em is twice the current font size, etc
exx-height, 1ex equals the x-height of a font
ininches
cmcentimeters
mmmillimeters
ptpoints, 1pt equals 1/72 inch
pcpicas, 1pc equals 12 points

Color Values

Defining color values in HTML and CSS can be accomplished in a few different ways, the most common being hexadecimal [hex]. Hex values are defined using the number sign [#] followed by a combination of six numbers and letters. Red, blue and green [RGB] can also be used by defining the number value [rgb(255,0,0)] or percentage value [rgb(100%,0%,0%)]. There are also 140 named colors, but they are not all valid according to the World Wide Web Consortium even though they are supported in all major browsers. Listed below are the 16 valid color names defined by the W3C.

NameHEXRGBColor
Aqua#00FFFFrgb(0,255,255) 
Black#000000rgb(0,0,0) 
Blue#0000FFrgb(0,0,255) 
Fuchsia#FF00FFrgb(255,0,255) 
Gray#808080rgb(128,128,128) 
Green#008000rgb(0,128,0) 
Lime#00FF00rgb(0,255,0) 
Maroon#800000rgb(128,0,0) 
Navy#000080rgb(0,0,128) 
Olive#808000rgb(128,128,0) 
Purple#800080rgb(128,0,128) 
Red#FF0000rgb(255,0,0) 
Silver#C0C0C0rgb(192,192,192) 
Teal#008080rgb(0,128,128) 
White#FFFFFFrgb(255,255,255) 
Yellow#FFFF00rgb(255,255,0) 

OTHER SITES


  • Equilibrium Studio
  • Jack & Jill's Haunted Hill
  • Jayati Yoga & Fitness
  • Pat's Picks Austin
  • Park Place Poker

THIS SITE


hosting powered by 100% wind energy