JavaScript Quick Reference [Link] – Free Quick References and .net components.
Variable Declaration Functions Operators
Var bFound= false; //Boolean //Normal Declaration Computational
var iCount= 0; //Integer function sum(x,y) - Unary negation
var fTotal= 2.5; //Floating Point Number { ++ Increment
var sName = ""; //String return x + y; -- Decrement
} * Multiplication
var dNow = new Date(); //Current Date / Division
var dPast= new Date(2002,5-1,20,23,59,59,999); //Optional Arguments % Modulo arithmetic
// (year, month - 1, day, hours, minutes, seconds, milliseconds) function requiredString(s, bAlert) + Addition
{ - Subtraction
var a = new Array(8); //Array var bValid= true;
Logical
if ([Link] == 0) ! Logical NOT
bValid= false; < Less than
Loops Common Events > Greater than
//While Loop onClick //If bAlert is not passed in, <= Less than or equal to
var x = 1; onSubmit //it will be equal to "undefined“ >= Greater than or equal to
while ( x <= 10 ) onMouseOver if (String(bAlert) == "true") == Equality
{ onMouseOut alert("String is required"); != Inequality
x++; onFocus } && Logical AND
} onChange || Logical OR
onBlur //Dynamic Arguments ?: Conditional (unary)
//For Loop onLoad function sumx() , Comma
for (var x = 1; x <= 10; x++ ) onUnload {
{ onKeyDown var iReturn=0; Bitwise
} onKeyPress ~ Bitwise NOT
for (var i=0;i < [Link];i++) << Bitwise Shift Left
//Do While Loop Built-In Functions iReturn+= arguments[i]; >> Bitwise Shift Right
var i = 0; Escape >>> Unsigned Shift Right
do Eval return iReturn; & Bitwise AND
{ isNaN } ^ Bitwise XOR
[Link](i + ".<BR>"); Number | Bitwise OR
i+=2; parseFloat
} parseInt Branching Assignment
while(i<20); String if ( (x == 1) && (y == 3) ) = Assignment
Unescape sum = y - x;
else Compound assignment operators
sum=0; += Addition
Alert, Prompt, Confirm -= Subtraction
[Link]("Hello Greg!"); switch(s) *= Multiplication
{ /= Division
sInput= prompt('Enter number to order','1'); case "A": %= Modulo Arithmetic
alert("A Chosen"); <<= Left Shift
if (confirm("Save before exiting?")) break; >>= Right Shift
{} >>>= Unsigned Right Shift
case "B": &= Bitwise And
alert("B Chosen"); |= Bitwise Or
Referencing Form Elements break; ^= Bitwise Xor
var sFirstName= [Link][0].[Link];
var sLastName= [Link]; // if all other conditions fail do this JavaScript Within Script Tag
var sZip= [Link][0].elements("txtZip").value; default; <script>
alert("Some other value chosen"); function myFunction()
break; {alert("Hi");}
} </script>
Regular Expression Pattern Test Split Into Array
var pat=/^\d{5}(-{0,1}\d{4}){0,1}$/ ; var a,s;
var sZip= “4322A” s="1,OH,2,IL";
if() //Invalid Zip Code a= [Link](","); JavaScript in External Files (Most Efficient)
{} <script defer language="Javascript" src="script/[Link]"></script>
Regular Expression Replace JavaScript Web References
mask = /\s|[,]|[$]/g; //Currency Chars [Link] [Link]
s=[Link](mask,''); //Remove [Link]
Popup Window String Methods
var sConfig= 'left=100, top=0, height=500, width=400, menubar=0, scrollbars=0, status=0, toolbar=0, location=0'; toUpperCase, toLowerCase,
var myWindow= [Link]("[Link] "MyWindowName", sConfig);} substr, substring, indexOf