=======================
The Math Object
=======================
The Math object allows you to perform common mathematical tasks.
The Math object is a top-level, built-in JavaScript object which
can be accessed without using a constructor or calling a method.
The Math object includes several mathematical values and functions.
You do not need to define the Math object before using it.
--------------------
Methods
Math.abs(x) Returns the absolute value of the variable x.
Math.cos(x) Returns the cosine of the variable x.
Math.log(x) Returns the natural log of the variable x.
Math.max(x,z) Returns the larger of the two variables x and z.
Math.min(x,z) Returns the smaller of the two variables x and z.
Math.pow(x,z) Returns the value of the variable x to the zth power.
Math.random() Returns a random number between 0 and 1.
Math.round(x) Returns the variable x rounded to the nearest integer.
Math.sin(x) Returns the sine of the variable x.
Math.sqrt(x) Returns the square root of the variable x.
Math.tan(x) Returns the tangent of the variable x.
--------------------
Properties
JavaScript provides eight mathematical values (constants)
also call properties, that can be accessed from the
Math object.
These are:
Math.E The constant of E, the base of natural logarithms.
Math.LN2 The natural logarithm of 2.
Math.LN10 The natural logarithm of 10.
Math.LOG2E The Base 2 logarithm of E.
Math.LOG10E The Base 10 logarithm of E.
Math.PI The value of PI.
Math.SQRT1_2 The Square root of 1/2.
Math.SQRT2 The Square root of 2.
--------------------
--------------------------------------------------
Using tabs
--------------------------------------------------
Tabs are a convenient way to utilize space on your web page
Add a table with on cell for each tab.
Place a link in each cell that will call the javascript
(ie., a href="javascript:tabs('Tab__0');"
The last cell is empty and usese most (90%) of the page width.
Add one row that spans all the tab cells (ie., colspan=4)
Add a div tag for each tab - this div will have an id which is
passed to the javascript (ie., < div id="Tab__2">.
Add your content between the div tags
At the end of the body add a script to call the opening tab
(ie., < script type="text/javascript" language="JavaScript">
tabs('Tab__0')< /script> )
See the source code of this page for more detail.
< table border = 1 width="100%">
< tr>
< td nowrap>
< !-- show_hide event call / start -->
< !-- ------- function + (which object) param -->
< a href="javascript:tabs('Tab__0');" >
Using Tabs
< /a>
< !-- show_hide event call / end -->
< /td>
...
< td width="90%">
< /td>
< /tr>
< tr>
< td colspan=4>
< !-- div section with tab param id / start -->
< !-- ---(which object) param -->
< div id="Tab__2" style="">
...
add you content ...
...
< !-- div section with tab param id / end -->
|