For textboxes, how do you set focus on the control?
Front
document.getElementById("TextBoxId").focus;
Back
In the <script> tag, how is the Type attribute used?
Front
<script type="text/javascript"> //Used to denote the type of script being used. Always this for JavaScript
Back
What is the string escape sequence to start a new line in JavaScript?
Front
Back
For checkboxes, how do you get the current checked status of the control?
Front
document.getElementById("checkboxId").checked;
Back
How do you assign the value from a prompt to a string?
Front
var stringVar = prompt("Text Here");
Back
What are the valid characters for an identifier in JavaScript?
Front
Letters, Numbers, Underscores, and Dollar Signs
Back
For textboxes, How do you set the control to be disabled?
Front
document.getElementById("TextBoxId").disabled = true; //Could also be false to enable it
Back
What is an event handler?
Front
A function that is called with a certain event occurs. Examples of these include button.onclick and window.onload.
Back
How do you code a while statement in JavaScript?
Front
while (condition) {}
Back
In the <script> tag, how is the Defer attribute used?
Front
<script defer="defer"> //Used to ensure the code doesn't run until the rest of the page has been loaded
Back
How do you declare a variable in JavaScript?
Front
var variableName;
Back
How do you test that a variable contains a valid number?
Front
isNaN(varHere); //Returns true or false.
Back
How do you display an alert?
Front
alert("Alert Text Here");
Back
What is the <noscript> tag used for?
Front
The text between the opening and closing tag is displayed if JavaScript is disabled or otherwise not available
Back
What are the four attributes of the <script> tag?
Front
Type, Src, Charset, and Defer
Back
How do you display a confirmation?
Front
confirm("Message Text Here");
Back
How do you access a page element by id?
Front
document.getElementById(id);
Back
How do you create a single line comment in JavaScript?
Front
With two forward slashes "//"
Back
For lists, how do you get the value or the currently selected item?
Front
document.getElementById("listId").value;
Back
How do you assign the return value of confirm() to a variable?
Front
var answerVar = confirm("Message Text Here");
Back
How do you assign actions to the window onLoad event?
Front
window.onload = function() {//actions here}
Back
What is AJAX?
Front
Asynchronous JavaScript And XML
Back
How do statements end in JavaScript?
Front
With a semicolon ";"
Back
How do you assign the value from a prompt to a non-string variable?
Front
Using a parse. Example : var intVar = parseInt(prompt("Text Here"));
Back
What is the command to display a prompt?
Front
prompt("Text Here");
Back
How do you create a Date object in JavaScript?
Front
var dateVar = new Date();
Back
Is JavaScript case sensitive?
Front
Yes
Back
How do you create a function in JavaScript?
Front
var functionName = function(param1, param2, paramN) {}
Back
In the <script> tag, how is the Src attribute used?
Front
<script src="fileName.js"> //Used to denote external file for script use
Back
How do you write text to the current element of the DOM?
Front
document.write("Text Here"); //Remains on current line
Back
What method allows you to set the digit precision of a decimal number?
Front
toFixed(digitCount);
Back
How do you code an If Else If statement in JavaScript?
Front
if (condition) {
}
else if (condition) {}
Back
How do you write a line to the current element of the DOM?
Front
document.writeln("Text Here"); //Advances to new line after text
Back
How do you assign a default value to a prompt?
Front
Using the second parameter. Example: prompt("Enter Age:", "18");
Back
How do you code a for statement in JavaScript?
Front
for (counter; condition; incrementor) {}
Back
For checkboxes, how do you get the text value of the control?
Front
document.getElementById("checkboxId").value;
Back
For radio buttons, how do you get the text value of the control?
Front
document.getElementById("radioButtonId").value;
Back
How do you code an If Else statement in JavaScript?
Front
if (condition){
}
else {}
Back
What values can confirm() return?
Front
True or false
Back
How do you denote a string in JavaScript
Front
With either single or double quotes surrounding the data
Back
For radio buttons, how do you get the current checked status of the control?
Front
document.getElementById("radioButtonId").checked;
Back
How do you code an If statement in JavaScript?
Front
if (condition) {}
Back
Section 2
(50 cards)
What is the format to create a new Date object from a string?
Front
var dateObject = new Date("11/22/2012 18:25:35");
Back
What Math object method is used to return a given number rounded to the next highest integer value?
Front
Math.ceil(number);
Back
What is the string escape sequence to insert a tab in JavaScript?
Front
\t
Back
What Date object method is used to return the number of milliseconds since the start of GMT?
Front
getTime();
Back
What Math object method is used to return the lowest value for a set of supplied numbers?
Front
Math.min(var1, var2, varN);
Back
For a text area, how do you get the current value of the control?
Front
document.getElementById("textAreaId").value;
Back
What is the string escape sequence to insert a single quote in JavaScript?
Front
\'
Back
What String object method is used to get the character at a specified index position?
Front
charAt(position);
Back
What Date object method is used to return a string containing the date and time?
Front
toString();
Back
What are the available set methods for a Date object?
Front
setFullYear(); //Sets 4 digit year
setMonth(); //Sets months, starts with 0 for January
setDate(); // Sets day of the month
setHours(); //Sets hours in the day
setMinutes(); //Sets the minutes in the current hour
setSeconds(); //Sets seconds in the current minute
setMilliseconds(); //Sets milliseconds in the current second
Back
What is the string escape sequence to insert a carriage return in JavaScript?
Front
\r
Back
What is the string escape sequence to insert a vertical tab in JavaScript?
Front
\v
Back
What are the available properties for the Number object?
What Math object method is used to return a given number that has been rounded to the closes integer value?
Front
Math.round(number);
Back
For checkboxes, how do you set the current checked status of the control?
Front
document.getElementById("CheckboxId").checked = true; //Could also be false
Back
What Math object method is used to return a given number rounded to the next lowest integer value?
Front
Math.floor(number);
Back
For radio buttons, how do you set the current checked status of the control?
Front
document.getElementById("radioButtonId").checked = true; //Could also be false
Back
What Number object method is used to return a string with a given number base?
Front
toString(base); //Bases can range from 2 to 36
Back
What Math object method is used to return the highest value from a set of supplied numbers?
Front
Math.max(var1, var2, varN);
Back
What is the string escape sequence to insert a backslash in JavaScript?
Front
\\
Back
What String object method is used return the position of the first instance of a specified search string, starting from the specified index?
Front
indexOf(searchValue, startPosition); //If no startPosition is specified, the search begins from the start of the string
Back
How do you alter the value of the text element in a span tag?
Front
document.getElementById("spanId").firstChild.nodeValue = "New Value";
Back
What is the string escape sequence to insert a double quote in JavaScript?
Front
\"
Back
What Number object method is used to return a number in exponential format with the specified number of decimal places?
Front
toExponential(digits);
Back
What Number object method is used to round numbers to the specified number of decimal places?
Front
toFixed(digits);
Back
How do you access the text element in a <span> tag?
Front
document.getElementById("spanId").firstChild;
Back
What Math object method is used to return the square root of a given number?
Front
Math.sqrt(number);
Back
What String object method returns a new string containing the value of the original string but in all upper case?
Front
toUpperCase();
Back
How do you concatenate multiple parts into a string?
Front
var stringVar = "part 1:" + "part 2";
Back
How do you create a new Date object?
Front
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds);
Back
What is the string escape sequence to insert a form feed in JavaScript?
Front
\f
Back
What are the available get methods for a Date object?
Front
getTime();
getFullYear(); //Returns 4 digit year
getMonth(); //Returns months, starts with 0 for January
getDate(); // Returns day of the month
getHours(); //Returns hours in the day
getMinutes(); //Returns the minutes in the current hour
getSeconds(); //Returns seconds in the current minute
getMilliseconds(); //Returns milliseconds in the current second
Back
What makes the identity operators different from the standard equality operators?
Front
They do not perform type coercion. //Eg. If data types don't match they fail the comparison
Back
What String object method is used to return a new string that contains part of the original string from the specified start position and up to but not including the specified stop index?
Front
substring(startIndex, stopIndex); //stopIndex is optional, if it is not specified, then it will go until the end of the string
Back
What are the events common to most controls?
Front
onfocus //Fired when control receives focus
onblur //Fired when control loses focus
onclick //Fired when the control is clicked
ondblclick //Fired when the control is double clicked
onchange //Fired when the control's value is changed
onselect //Fired when text is selected in a textbox or text area
Back
What String object method returns a new string containing the value of the original string but in all lower case?
Front
toLowerCase();
Back
Section 3
(3 cards)
What is the identity operator for equals?
Front
===
Back
What is the format for a switch statement in JavaScript?
Front
switch (inputVar) {
case "caseSwitch1":
//Operations here
//No break so it cascades to caseSwitch2.
case "caseSwitch2":
//Operations here
break; //Break so it will not continue to cascade down.
}