Topics:
JavaScript Terms
JavaScript Methods
- alert
- prompt
- confirm
- eval
- parseInt
- open
Flow of control / programming structures
- selection
if / if-else
- repetition
for / while
Functions
- declaring
function mystery(a, b, c) { var secret = "now, "; if (a) secret += a + "
"; if (b)
secret += b + " "; if (c) secret += c + " "; alert(secret); }
- calling
- parameter passing
Which of these will pass values to a and c only? Why not?
1.
onclick ="mystery('go', null, 'sea hawks');"
2. onclick="mystery('go', "", 'sea hawks');"
3. onclick="mystery('go', '', 'sea hawks');"
4. onclick="mystery('go', , 'sea hawks');"
Arrays
- initializer lists
- assigning values to
- getting values from
- using in loops
Variables
Math
- round()
- random()
- scale and shift
- operators: +, -, *, %, /
URLs
- relative versus absolute addressing
Tables
- Code to change cell background color if answer is correct
JavaScript Objects /
JavaScript Properties
JavaScript Event Handlers
- onBlur Blurs occur when a
select, text or textarea field on a form loses focus.
Event handler of select, text, textarea. See
EVENT HANDLERS onChange and onFocus.
- onChange A change event happens when a select,
text, or textarea element on a form is modified before
losing focus. Event handler of select, text, textarea.
See EVENT HANDLERS onBlur, onFocus.
- onClick Occurs when an object, such as a button or check
box, is clicked. Event handler of button, checkbox,
radio, link, reset, submit.
- onFocus A form element receives focus by tabbing to or
clicking the input area with the mouse. Selecting within a field results in
a select event. Event handler of select, text,
textarea. See EVENT HANDLERS onBlur and onChange.
- onLoad A load event is created when Navigator finishes
loading a window or all frames within a <frameset> tag. Event
handler of window. See onUnload EVENT HANDLER.
- onMouseOver / onMouseDown / onMouseMove
/ onMouseUp / onMouseOut Occurs when the
mouse pointer is placed over
a link object. To function with the status or
defaultStatus properties, the event handler must return true.
Event handler of link.
//assign functions to the mouse event
document.onmousedown = start;
document.onmousemove = checkLocation;
document.onmouseup = stop;
//sample function definitions
function start(e) { if (started == 0) { moveEnemies(); startClock(); started
= 1; }
curX = window.event.x ;
curY = window.event.y ;
curX2 = eval(curX - 40);
curY2 = eval(curY - 40);
boxX = eval(curX - 20);
boxY = eval(curY - 20);
var boxleft = givePosX('box');
var boxtop = givePosY('box');
if (curX > boxleft && curX2 < boxleft && curY > boxtop && curY2 < boxtop) {
moving = 1; setPosX('box', boxX); setPosY('box', boxY); }
}
function checkLocation(e){ ...}
function stop(e){ moving = 0; }
- onSelect A select event is triggered by selecting some or
all of the text in a text or textarea field. Event handler
of text, textarea.
- onSubmit Triggered by the user submitting a form. The
event handler must return true to allow the form to be submitted to
the server. Conversely, it returns false to block the form's
submission. Event handler of form. See submit OBJECT and
METHOD.