![]() ![]() ![]() ![]() |
![]() |
Appendix A Index of Built-in Calls |
Math Calls: | Format: |
.abs() | x=Math.abs(y ); |
.ceil() | x=Math.ceil(y ); |
.exp | x=Math.exp(y,z); |
.fixed | x=Math.fixed(y); |
.floor() | x =Math.floor(y ); |
.pow() | x=Math.pow(y,z ); |
.random() | x=Math.random( ); |
.round() | x=Math.round(y ); |
.SQRT1_2 | x=Math.SQRT1_2; |
.SQRT2 | x=Math.SQRT2; |
.sqrt() | x=Math.sqrt(y ); |
.max() | x=Math.max(y,z ); |
.min() | x=Math.min(y,z ); |
String-Numeric Conversions parseFloat() parseInt() eval() |
Format: x=parseFloat(variable); x=parseInt(variable,y); x=eval(variable); |
Trigonometric Functions PI sin() asin() cos() acos() tan() atan() exp() |
Format: x=Math.PI; x=Math.sin(y); x=Math.asin(y); x=Math.cos(y); x=Math.acos(y); x=Math.tan(y); x=Math.atan(y); x=Math.exp(y); |
Logarithms .E .log() .LN2 .LN10 .LOG2E .LOG10E |
Format: x=Math.E; x=Math.log(y); x=Math.LN2; x=Math.LN10; x=Math.LOG2E; x=Math.LOG10E; |
Action Calls: onBlur onClick onFocus onLoad onMouseover onMouseoff onSubmit onUnload |
Format: onBlur="javascript"; onClick="javascript"; onFocus="javascript"; onLoad="javascript"; onMouseover="javascript"; onMouseoff="javascript"; onSubmit="javascript"; onUnload="javascript" |
Alert Calls: alert() confirm() prompt() |
Format: alert("Message to user"); confirm("Msg to user"); prompt("Msg to user",x); |
These next are "shortcut" calls to replace writing literal HTML calls from JavaScript using the document.write(""); calls - string may be either a literal string or a variable set equal to a string. | |
HTML Calls: .anchor() .big() .blink() .bold() .click() .fontcolor() .fontsize() .small() .strike() .italics() .link() .sub() .sup() |
Format: string.anchor(); string.big(); string.blink(); string.bold(); string.click(); string.fontcolor(); string.fontsize(); string.small(); string.strike(); string.italics(); string.link(); string.sub(); string.sup(); |
Navigation Calls: history history history location |
Format: history.back(); history.forward(); history.go(); location.href |
Time/Date Calls: new Date() setTimeout() clearTimeout() getDate getDay getHours getMinutes getMonth getSeconds getTime getTimezoneOffset getYear setDate setHours setMinutes setMonth setSeconds setTimeout setTime setYear UTC |
Format: variable=new Date(); setTimeout("action",x); clearTimeout(variable); var=date_var.getDate(); var=date_var.getDay(); var=date_var.getHours(); var=date_var.getMinutes(); var=date_var.getMonth(); var=date_var.getSeconds(); variable.getTime(); variable.getTimezoneOffset var=date_var.getYear(); variable.setDate(); variable.setHours(); variable.setMinutes(); variable.setMonth(); variable.setSeconds(); setTimeout(string,x); variable.setTime(); variable.setYear(); variable=new Date(Date.UTC()); |
String Parse Calls: .charAt() indexOf lastIndexOf substring toGMTString toLocaleString toLowerCase toUpperCase escape unescape |
Format: var=string.charAt(x); x=string.indexOf(var); x=string.lastIndexOf(var); var=string.substring(x,y); var=string.toGMTString; var=string.toLocaleString; var=string.toLowerCase; var=string.toUpperCase; var1=escape(var2); var1=unescape(var2); |
String/Numeric Calls: eval ""+ ""+ isNaN |
Format: x=eval(string); string=""+numeric; string=""+x; see text |
Document Calls: open(document) open(window) close(document) blur() close(window) focus() clear() select() submit() write() writeln() checked() selected() window.status defaultChecked() defaultSelected() |
Format: document.open(); window_name.open(); document.close(); document.form.ele.blur(); window_name.close(); document.form.ele.focus(); document_name.clear(); document.form.ele.select(); document.form.submit(); document.write(""); document.writeln(""); document.form.ele.checked(); document.form.ele.selected(); window.status=variable; document.form.ele.defaultChecked(); document.form.ele.defaultSelected(); |
Symbols: > < == != || && ? a:b |
Meaning: greater than less than equivalent (equal) to not equivalent (equal) to or and prior true? if true a, otherwise b |
Action Symbols: += |
Usage: a string variable concatenater (str+="a" same as str=str+"a") |
+= | a numeric variable adder (x+=y is the same as x=x+y) |
*= | a numeric variable multiplier (x*=y is the same as x=x*y) |
/= | a numeric variable divider (x/=y is the same as x=x/y) |
<<= | a numeric bitwise operator (x<<=y the same as x=x<<y) |
>>= | a numeric bitwise operator (x>>=y the same as x=x>>y) |
&= | a numeric bitwise operator (x&=y the same as x=x&y) |
^= | a numeric bitwise operator (x^=y the same as x=x^y) |
|= | a numeric bitwise operator (x|=y the same as x=x|y) |
%= | a numeric modulus operator (x%=y the same as x=x%y - a modulus is the remainder of a division of the first variable by the second) |
x++ | a numeric variable incrementer (x++ is the same as x=x+1) [If used for setting another value first returns present value of x, then increments it) |
x-- | a numeric variable decrementer (x-- is the same as x=x-1) [If used for setting another value first returns present value of x, then decrements it] |
++x | a numeric variable incrementer (first increments the value of x, then sets variable equal to x) |
--x | a numeric variable decrementer (first decrements the value of x, then sets variable equal to x) |