Autor: Blog da Biazinha | Publicado: 2011-07-23T08:56:00-07:00

&lt;script type="text/javascript"&gt;
function addEvent_imc(elm, evType, fn, useCapture)
{
// cross-browser event handling by Scott Andrew
&nbsp;if(elm.addEventListener){
&nbsp;&nbsp;elm.addEventListener(evType, fn, useCapture);
&nbsp;&nbsp;return true;
&nbsp;}
&nbsp;else if(elm.attachEvent)
&nbsp;{
&nbsp;&nbsp;var r = elm.attachEvent('on' + evType, fn);
&nbsp;&nbsp;return r;
&nbsp;}
&nbsp;else
&nbsp;{
&nbsp;&nbsp;elm['on' + evType] = fn;
&nbsp;}
}
function addListeners_imc(e){
&nbsp;if(!document.getElementById)
&nbsp;&nbsp;return;
&nbsp;&nbsp;var calcula_btn = document.getElementById('calcula_btn_imc');
&nbsp;&nbsp;addEvent_imc(calcula_btn, 'click', imc, false);
}
function imc(e){

&nbsp;var peso = parseFloat(document.getElementById('peso_imc').value);
&nbsp;var altura_m = parseFloat(document.getElementById('altura_m_imc').value);
&nbsp;var altura_cm = parseFloat(document.getElementById('altura_cm_imc').value);
&nbsp;var altura = (altura_m * 100 + altura_cm)/100;
&nbsp;var imc = peso/(altura*altura);
&nbsp;if(isNaN(imc))
&nbsp;{
&nbsp;&nbsp;alert('use apenas numeros para suas medidas');
&nbsp;&nbsp;return false;
&nbsp;}
&nbsp;&nbsp;imc = Math.round(imc*100)/100;
&nbsp;&nbsp;alert('Seu IMC: ' + imc);
&nbsp;}
&nbsp;&nbsp;addEvent_imc(window, 'load', addListeners_imc, false);
&lt;/script&gt;
&lt;form id="imc"&gt;
&nbsp;&lt;table width="131" align="center" height="128" border="0" cellpadding="3" cellspacing="1" style="font-size:11px;font-family: arial;background-color:#000000;align=center"&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;th height="22" colspan="2" style="background-color:#66cc99;color:#000;text-align:center;"&gt;Calculadora de IMC&lt;/th&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td height="26" style="background-color:#ccffcc"&gt;Peso:&lt;/td&gt;
&nbsp;&lt;td style="background-color:#ccffcc"&gt;&lt;input type="text" id="peso_imc" style="font-size:11px;font-family:arial;width:25px" /&gt; kg&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td height="26" style="background-color:#ccffcc"&gt;Altura:&lt;/td&gt;
&nbsp;&lt;td style="background-color:#ccffcc" nowrap="nowrap"&gt;
&nbsp;&lt;input type="text" id="altura_m_imc" style="font-size:11px;font-family:arial;width:25px" /&gt;
&nbsp;m
&nbsp;&lt;input type="text" id="altura_cm_imc" style="font-size:11px;font-family:arial;width:25px" /&gt;
&nbsp;cm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td height="30" colspan="2" align="center" style="background-color:#ccffcc"&gt;
&nbsp;&lt;input type="button" value="calcular" id="calcula_btn_imc" style="font-size: 11px;font-family: arial;" /&gt;&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td colspan="2" style="font-size:10px;background-color:#007236;" align="right"&gt;&lt;a href="http://www.anutricionista.com/" target="_blank" style="color:#000;"&gt;Nutricionista&lt;/a&gt;&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;/table&gt;
&lt;/form&gt;
&nbsp;&nbsp;&nbsp;&lt;script type="text/javascript"&gt;
function addEvent_imc(elm, evType, fn, useCapture)
{
// cross-browser event handling by Scott Andrew
&nbsp;if(elm.addEventListener){
&nbsp;&nbsp;elm.addEventListener(evType, fn, useCapture);
&nbsp;&nbsp;return true;
&nbsp;}
&nbsp;else if(elm.attachEvent)
&nbsp;{
&nbsp;&nbsp;var r = elm.attachEvent('on' + evType, fn);
&nbsp;&nbsp;return r;
&nbsp;}
&nbsp;else
&nbsp;{
&nbsp;&nbsp;elm['on' + evType] = fn;
&nbsp;}
}
function addListeners_imc(e){
&nbsp;if(!document.getElementById)
&nbsp;&nbsp;return;
&nbsp;&nbsp;var calcula_btn = document.getElementById('calcula_btn_imc');
&nbsp;&nbsp;addEvent_imc(calcula_btn, 'click', imc, false);
}
function imc(e){

&nbsp;var peso = parseFloat(document.getElementById('peso_imc').value);
&nbsp;var altura_m = parseFloat(document.getElementById('altura_m_imc').value);
&nbsp;var altura_cm = parseFloat(document.getElementById('altura_cm_imc').value);
&nbsp;var altura = (altura_m * 100 + altura_cm)/100;
&nbsp;var imc = peso/(altura*altura);
&nbsp;if(isNaN(imc))
&nbsp;{
&nbsp;&nbsp;alert('use apenas numeros para suas medidas');
&nbsp;&nbsp;return false;
&nbsp;}
&nbsp;&nbsp;imc = Math.round(imc*100)/100;
&nbsp;&nbsp;alert('Seu IMC: ' + imc);
&nbsp;}
&nbsp;&nbsp;addEvent_imc(window, 'load', addListeners_imc, false);
&lt;/script&gt;
&lt;form id="imc"&gt;
&nbsp;&lt;table width="131" align="center" height="128" border="0" cellpadding="3" cellspacing="1" style="font-size:11px;font-family: arial;background-color:#000000;align=center"&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;th height="22" colspan="2" style="background-color:#66cc99;color:#000;text-align:center;"&gt;Calculadora de IMC&lt;/th&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td height="26" style="background-color:#ccffcc"&gt;Peso:&lt;/td&gt;
&nbsp;&lt;td style="background-color:#ccffcc"&gt;&lt;input type="text" id="peso_imc" style="font-size:11px;font-family:arial;width:25px" /&gt; kg&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td height="26" style="background-color:#ccffcc"&gt;Altura:&lt;/td&gt;
&nbsp;&lt;td style="background-color:#ccffcc" nowrap="nowrap"&gt;
&nbsp;&lt;input type="text" id="altura_m_imc" style="font-size:11px;font-family:arial;width:25px" /&gt;
&nbsp;m
&nbsp;&lt;input type="text" id="altura_cm_imc" style="font-size:11px;font-family:arial;width:25px" /&gt;
&nbsp;cm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td height="30" colspan="2" align="center" style="background-color:#ccffcc"&gt;
&nbsp;&lt;input type="button" value="calcular" id="calcula_btn_imc" style="font-size: 11px;font-family: arial;" /&gt;&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td colspan="2" style="font-size:10px;background-color:#007236;" align="right"&gt;&lt;a href="http://www.anutricionista.com/" target="_blank" style="color:#000;"&gt;Nutricionista&lt;/a&gt;&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;/table&gt;
&lt;/form&gt;
&nbsp;&nbsp;&nbsp;&lt;script type="text/javascript"&gt;
function addEvent_imc(elm, evType, fn, useCapture)
{
// cross-browser event handling by Scott Andrew
&nbsp;if(elm.addEventListener){
&nbsp;&nbsp;elm.addEventListener(evType, fn, useCapture);
&nbsp;&nbsp;return true;
&nbsp;}
&nbsp;else if(elm.attachEvent)
&nbsp;{
&nbsp;&nbsp;var r = elm.attachEvent('on' + evType, fn);
&nbsp;&nbsp;return r;
&nbsp;}
&nbsp;else
&nbsp;{
&nbsp;&nbsp;elm['on' + evType] = fn;
&nbsp;}
}
function addListeners_imc(e){
&nbsp;if(!document.getElementById)
&nbsp;&nbsp;return;
&nbsp;&nbsp;var calcula_btn = document.getElementById('calcula_btn_imc');
&nbsp;&nbsp;addEvent_imc(calcula_btn, 'click', imc, false);
}
function imc(e){

&nbsp;var peso = parseFloat(document.getElementById('peso_imc').value);
&nbsp;var altura_m = parseFloat(document.getElementById('altura_m_imc').value);
&nbsp;var altura_cm = parseFloat(document.getElementById('altura_cm_imc').value);
&nbsp;var altura = (altura_m * 100 + altura_cm)/100;
&nbsp;var imc = peso/(altura*altura);
&nbsp;if(isNaN(imc))
&nbsp;{
&nbsp;&nbsp;alert('use apenas numeros para suas medidas');
&nbsp;&nbsp;return false;
&nbsp;}
&nbsp;&nbsp;imc = Math.round(imc*100)/100;
&nbsp;&nbsp;alert('Seu IMC: ' + imc);
&nbsp;}
&nbsp;&nbsp;addEvent_imc(window, 'load', addListeners_imc, false);
&lt;/script&gt;
&lt;form id="imc"&gt;
&nbsp;&lt;table width="131" align="center" height="128" border="0" cellpadding="3" cellspacing="1" style="font-size:11px;font-family: arial;background-color:#000000;align=center"&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;th height="22" colspan="2" style="background-color:#66cc99;color:#000;text-align:center;"&gt;Calculadora de IMC&lt;/th&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td height="26" style="background-color:#ccffcc"&gt;Peso:&lt;/td&gt;
&nbsp;&lt;td style="background-color:#ccffcc"&gt;&lt;input type="text" id="peso_imc" style="font-size:11px;font-family:arial;width:25px" /&gt; kg&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td height="26" style="background-color:#ccffcc"&gt;Altura:&lt;/td&gt;
&nbsp;&lt;td style="background-color:#ccffcc" nowrap="nowrap"&gt;
&nbsp;&lt;input type="text" id="altura_m_imc" style="font-size:11px;font-family:arial;width:25px" /&gt;
&nbsp;m
&nbsp;&lt;input type="text" id="altura_cm_imc" style="font-size:11px;font-family:arial;width:25px" /&gt;
&nbsp;cm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td height="30" colspan="2" align="center" style="background-color:#ccffcc"&gt;
&nbsp;&lt;input type="button" value="calcular" id="calcula_btn_imc" style="font-size: 11px;font-family: arial;" /&gt;&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;tr&gt;
&nbsp;&lt;td colspan="2" style="font-size:10px;background-color:#007236;" align="right"&gt;&lt;a href="http://www.anutricionista.com/" target="_blank" style="color:#000;"&gt;Nutricionista&lt;/a&gt;&lt;/td&gt;
&nbsp;&lt;/tr&gt;
&nbsp;&lt;/table&gt;
&lt;/form&gt;
&nbsp;&nbsp;