Use parenthesis in expression 2 : Expressions : Language Basics JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Language Basics » Expressions »

 

Use parenthesis in expression 2

















<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
function calcArea()
{
    inpRadius = 3;
    document.write(Math.PI * ((inpRadius)*(inpRadius)));
}

function calcPeri()
{
    inpRadius = 3;
    document.write(* Math.PI * (inpRadius));
}

function calcVol()
{
    inpRadius = 3;
    document.write(Math.PI * ((inpRadius)*(inpRadius)*(inpRadius)) (4/3));
}
//  -->
</script>
</head>
<body>
<h1>All about Circles and Spheres!</h1>
<P>Click <input type="button" value="HERE" onclick="calcArea();"> to calculate circle area!</p>
<br>
<P>Click <input type="button" value="HERE" onclick="calcPeri();"> to calculate circle perimeter!</p>
<br>
<P>Click <input type="button" value="HERE" onclick="calcVol();"> to calculate sphere volume!</p>
</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Language Basics
» Expressions