<!--WHR CALCULATOR--> <!-- This part goes in the HEAD of the html file --> <script language="JavaScript" type="text/javascript"> <!-- Copyright 2006, Sandeep Gangadharan --> <!-- For more free scripts go to http://www.sivamdesign.com/scripts/ --> <!-- function get_whr() { if (document.whr_calc.waist.value.length == 0) { alert('Waist field is empty!'); return false; } if (document.whr_calc.hip.value.length == 0) { alert('Hip field is empty!'); return false; } num1 = Math.pow(10, 2); document.whr_calc.result_whr.value = document.whr_calc.waist.value / document.whr_calc.hip.value; document.whr_calc.result_whr.value = Math.round(document.whr_calc.result_whr.value * num1) / num1; if (document.whr_calc.gender[0].checked) { if (document.whr_calc.result_whr.value <= 0.80) { document.whr_calc.verdict_whr.value = "Your waist-to-hip ratio is Good and you fall in the Low Risk category!"; } if ((document.whr_calc.result_whr.value > 0.80) && (document.whr_calc.result_whr.value < 0.85)) { document.whr_calc.verdict_whr.value = "Your waist-to-hip ratio is Acceptable and you fall in the Moderate Risk category!"; } if (document.whr_calc.result_whr.value >= 0.85) { document.whr_calc.verdict_whr.value = "Your waist-to-hip ratio is Poor and you fall in the High Risk category!"; } } if (document.whr_calc.gender[1].checked) { if (document.whr_calc.result_whr.value <= 0.95) { document.whr_calc.verdict_whr.value = "Your waist-to-hip ratio is Good and you fall in the Low Risk category!"; } if ((document.whr_calc.result_whr.value > 0.95) && (document.whr_calc.result_whr.value <= 1.00)) { document.whr_calc.verdict_whr.value = "Your waist-to-hip ratio is Acceptable and you fall in the Moderate Risk category!"; } if (document.whr_calc.result_whr.value > 1.00) { document.whr_calc.verdict_whr.value = "Your waist-to-hip ratio is Poor and you fall in the High Risk category!"; } } } //--> </script> <!-- This goes into the BODY of the file --> <form name="whr_calc"> <table border="0" align="center" cellspacing="3" cellpadding="0" width="300" bgcolor="#c0c0c0"> <tr> <td colspan="2" align="center"> <label for="w"><input type="radio" id="w" name="gender" checked /><b>Female</b></label>&nbsp;&nbsp; <label for="m"><input type="radio" id="m" name="gender" /><b>Male</b></label> </td> </tr> <tr> <td align="right"> <b>Waist:</b>&nbsp; </td> <td> <input type="text" name="waist" size="5" /> &nbsp;Inches </td> </tr> <tr> <td align="right"> <b>Hip:</b>&nbsp; </td> <td> <input type="text" name="hip" size="5" /> &nbsp;Inches </td> </tr> <tr> <td align="center"> <input type="button" value="Get Result" onclick="get_whr()" /> <input type="reset" value="Reset" /> </td> </tr> <tr> <td align="right"> <b>Result:</b>&nbsp; </td> <td> <input type="text" name="result_whr" size="10" /> </td> </tr> <tr> <td align="right"> <b>Verdict:</b>&nbsp; </td> <td> <textarea col="25" rows="4" name="verdict_whr" wrap="virtual"></textarea> </td> </tr> </table> </form>