Using Tabs Math Object Math Examples  
======================= 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. --------------------

x value: z value:
-------------------------------------------------- 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%"> &nbsp; < /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> < !-- div section with tab param id / end --> <!-- div section with tab param id / end --> </td> </tr> </table> < script type="text/javascript" language="JavaScript"> tabs('Tab__0')< /script> Example (tabs/js) < script src="js/tabs.js" language="javascript1.2"></script> --------------------------------------------------- function tabs(whichLayer) { var layers_= new Array() layers_[0] = 'Tab__0' //2 layers_[1] = 'Tab__1' //3 layers_[2] = 'Tab__2' //1 var styleX var style2 if (document.getElementById) { //alert('standard') // this is the way the standards work style2 = document.getElementById(whichLayer).style; style2.display = style2.display? "block":"block"; for(i=0;i<=layers_.length-1;i++) { if(layers_[i] != whichLayer) { //alert(whichLayer + " " + layers_[i]); styleX = document.getElementById(layers_[i]).style; styleX.display = styleX.display? "":""; } } }// end if (document.getElementById) else if (document.all) { // alert('ie old') // this is the way old msie versions work style2 = document.all[whichLayer].style; style2.display = style2.display? "block":"block"; for(i=0;i<=layers_.length-1;i++) { if(layers_[i] != whichLayer) { //alert(whichLayer + " " + layers_[i]); styleX = document.getElementById(layers_[i]).style; styleX.display = styleX.display? "":""; } } }// end else if (document.all) else if (document.layers) { //alert('nn4 old') // this is the way nn4 works style2 = document.layers[whichLayer].style; style2.display = style2.display? "":"block"; for(i=0;i<=layers_.length-1;i++) { if(layers_[i] != whichLayer) { //alert(whichLayer + " " + layers_[i]); styleX = document.getElementById(layers_[i]).style; styleX.display = styleX.display? "":""; } } } // end else if (document.layers) } // end function
view the source of this document.