I want calculate using <b>switch statement</b> unable to do it. What could be the error. <br>Tried using if condition and for loop doesn't work. <br><br><b>Want to calculate each location, position and display the total with respective location and position at the bottom <br>What could be error and how to call all function in one function. </b><br> <br>function calc1() { <br> function loc1()<br> function loc2()<br>} <br><br><br><HTML><HEAD><br><SCRIPT language="JavaScript"><br><!-- <br> function position(pos){<br> var t=0;<br> switch(pos)<br> {<br> case 10:{t=10; break; }<br> case 9: {t=9; break; }<br> case 8: {t=8; break; }<br> case 7: {t=7; break; }<br> case 6: {t=6; break; }<br> case 5: {t=5; break; }<br> case 4: {t=4; break; }<br> case 3: {t=3; break; }<br> <br> default:<br> alert("You Must Select" break;<br> }<br>}<br><br> function location(loc){<br> var t1;<br> switch(loc)<br> {<br> case 10:{t1=10; break; }<br> case 9: {t1=9; break; }<br> case 8: {t1=8; break; }<br> case 7: {t1=7; break; }<br> case 6: {t1=6; break; }<br> case 5: {t1=5; break; }<br> case 4: {t1=4; break; }<br> case 3: {t1=3; break; }<br> <br> default:<br> alert("You Must Select" break;<br> }<br>}<br><br>function calc(testform){<br> var ttotal1;<br> call function position(pos);<br> {ttotal1 = parseInt(t); }<br> function location(loc);<br> {ttotal1 = ttotal1 + parseInt(t1);}<br>}<br></script><br><br></HEAD><br><br><BODY BGCOLOR="#FFFFFF"><br><br><form name="testform" > <br><br><table border=1><br> <tr><td><br> <br> Q1 What is the position <BR><font size="1"><br><br> <INPUT TYPE="radio" NAME="pos" Value="10">North East<br> <BR><br> <INPUT TYPE="radio" NAME="pos" Value="9">East<br> <BR><br> <INPUT TYPE="radio" NAME="pos" Value="8">North<br> <BR> <br> <INPUT TYPE="radio" NAME="pos" Value="7">North West<br> <BR><br> <INPUT TYPE="radio" NAME="pos" Value="6">South East<br> <BR><br> <INPUT TYPE="radio" NAME="pos" Value="5">West<br> <BR><br> <INPUT TYPE="radio" NAME="pos" Value="4">South<br> <BR><br> <INPUT TYPE="radio" NAME="pos" Value="3">South West<br> <br> </font><br><br> </td></tr><br><br> <tr><td><br> <br> Q2 Where is the Location? <br><font size="1"><br> <br> <INPUT TYPE="radio" NAME="loc" Value="10">South East<br> <BR><br> <INPUT TYPE="radio" NAME="loc" Value="9">North West<br> <BR><br> <INPUT TYPE="radio" NAME="loc" Value="8">East<br> <BR><br> <INPUT TYPE="radio" NAME="loc" Value="7">West<br> <BR><br> <INPUT TYPE="radio" NAME="loc" Value="6">South <br> <BR><br> <INPUT TYPE="radio" NAME="loc" Value="5">North<br> <BR><br> <INPUT TYPE="radio" NAME="loc" Value="4">North East<br> <BR><br> <INPUT TYPE="radio" NAME="loc" Value="3">South West<br><br> </font><br> <br> </td></tr><br><br> <tr><td><br><br> <INPUT type=button value="Get your Location" onClick="calc(testform);"> <br> <br> <INPUT type=reset value=clear> <br> </TD></TR><br><br> <TR colspan=2><TD align="center"><FONT face=arial size=2><br> <br> Result </FONT><br> <br> <FONT size=3><br><br> <INPUT name=result size=4></FONT><br> </TD></TR><br> </TBODY></TABLE></FORM><br><br><table border="1" summary="Total Location"><br><br> <tr>Your Location<br> <br> <th>No.</th> <th>Questions</th> <th>Points</th> <th> Your Location</th><br><br> <tr><td align="right">1</td><br> <td>Your position is</td><br> <br> <td align="right">10</td><br> <td align="right"><!-- Selected Position value to display --> </td><br> </tr><br><br> <tr><td align="right">2</td><br> <td>Your Location is </td><br> <br> <td align="right">10</td><br> <td align="right"><!-- Selected Location value to display --> </td><br> </tr><br> <tr><td> </td><br> <td align="right"><B>Total </B></td><br> <td align="right"><B>100</B></td><br> <td align="right"><B> <!-- Total value to display --> </B></td><br> </tr><br> </tr><br></table></div><br></BODY><br></HTML>