JavaScript Tutorial
I dedicate this Tutorial to you, dear friends, all around the world. by_ Shahin Noursalehi
<Prev.  (Main) 

JSrcipt Tutorial
Lesson: 9

Sample Description:
Angle's...!

User Level:
1.New
2.Casual
3.Accomplished
4.Expert




About Lesson 9:

The Angle's...! sample is a simple usage of Math object that is built in JavaScript. This sample prompts you to enter an angle in degree.
Then the JavaScript calculates it's Sin, Cos, Tan, Cotangent of that angle and alerts you 'Job Complete'!
Just click on the 'Go!' button!




























Test the sample!

 The Radians:

<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<SCRIPT language=javascript>
<!--
function salaam8() {
var d;
d=window.prompt('Enter the angle in Degree:','');
d= (d * 3.14)/180;
text8.value= d;
for (i=0; i<=5 ; i++){
switch (i){
case 0:
si= Math.sin(d);
window.alert ('Sin: ' + si)
break
case 1:
co= Math.cos(d);
window.alert ('Cos: ' + co)
break
case 2:
ta=si/co;
window.alert ('Tan: ' + ta)
break
case 3:
cota=co/si;
window.alert ('CoTan: ' + cota)
break
case 4:
ab=Math.abs(d);
window.alert ('Abs: ' + ab)
break
default:
window.alert ('Job Complete!')
}
}
}
/-->
</SCRIPT>
<BODY bgcolor=white>
<INPUT id=button4 name=button4 type=button value=Go! LANGUAGE=javascript onclick="return salaam8()"> The Radians: <INPUT id=text8 name=text8 width="50" style="WIDTH: 70px" readOnly> </BODY>
</HTML>



© 2000 by MixofTix Developers Network. All rights reserved.