<script type="text/javascript"> var btn = document.getElementById('calculate'); btn.onclick = function() { // get the input values var temp = parseInt(document.getElementById('temp').value); var cond = (document.getElementById('cond').value); var wind = parseInt(document.getElementById('wind').value); // get the elements to hold the results var resultchill = document.getElementById('resultchill'); var result1 = document.getElementById('result1'); var result2 = document.getElementById('result2'); var result3 = document.getElementById('result3'); var result4 = document.getElementById('result4'); var result6 = document.getElementById('result6'); var result7 = document.getElementById('result7'); var result8 = document.getElementById('result8'); var result9 = document.getElementById('result9'); // create an empty array to hold error messages var msg = []; // check each input value, and add an error message // to the array if it's not a number if (isNaN(temp)) { msg.push('Please Enter a Valid Number for Temperature'); } if (isNaN(wind)) { msg.push('Please Enter a Valid Number for Wind Speed'); } // if the array contains any values, display the error message(s) // as a comma-separated string in the first <span> element if (msg.length > 0) { resultchill.innerHTML = msg.join(', '); } else { if (wind>3){ // otherwise display the results in the <span> elements chill = (0.0817*(3.71*(Math.pow(wind, 0.5))+5.81-0.25*wind)*(temp-91.4)+91.4); } else { chill = temp; } resultchill.innerHTML = 'With wind chill it feels like: ' + chill.toFixed(1); if(cond=="Rain"){ chill=chill-3; } if(cond=="Snow"){ chill=chill-7; } if(chill<42){ } else if(chill<73) { result1.innerHTML = '' } else if(cond=="Sun"){ result1.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Baseball Cap</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B0023EDE3Q&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B00574SLN2&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>A hat with a visor serves not only to keep the sun out of your eyes, but also to shield them from blowing snow and rain on the run. A lighter-colored hat helps to keep your head cool on warm days.</td></tr></table>'; } else { result1.innerHTML = ''; } if(chill<50){ result2.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Long-sleeve Shirt</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B006MYLVJC&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B002L3TNAW&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>A long-sleeved shirt made of high-tech polyester will pull moisture away from your skin, keeping you from getting clammy and cold on a cooler day.</td></tr></table>'; } else if(chill<85) { result2.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Short-sleeve Shirt</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B006XG848A&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B0058YXT4M&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>Or singlet, or for women, as little as a jog-bra. The minumum upper-body coverage. While this may look like a classic T-shirt, a runner is actually best-off with a technical fabric like CoolMax which will pull sweat away from the skin, instead of absorbing it like cotton. This added comfort, combined with sun protection, can make a technical T-shirt a better choice than no shirt at all.</td></tr></table>'; } else { result2.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Tank Top / Jog Bra</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B004GCIN0W&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B0049EOGWQ&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>Tank top or jog bra.</td></tr></table>'; } if(chill<39){ result3.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Jacket</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B0042JTZPG&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B001VVIB6M&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>A jacket, usually a polyester blend, serves to keep you warm, keep off wind, rain, and snow, and manage your perspiration. It's an essential piece of equipment on cold, windy and/or rainy days.</td></tr></table>'; } else if(chill<52) { result3.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Vest</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B0059AQZ32&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B003BLOU7O&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>Essentially a jacket without sleeves, a vest provides the wind-blocking and water-resistant functions of a running jacket, but only for the body's core, leaving the arms uncovered - warm, but not too warm.</td></tr></table>'; } else { result3.innerHTML = ''; } if(chill<40){ result4.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Running Tights</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B002S610GM&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B003YSV3ME&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>The first level of insulation for your legs. "Classic" tights are generally a polyester and Lycra® blend. Looser running pants (also stretchy, but not as form-fitting as tights) are another option here. In extreme cold, tights under pants is a good layering strategy.</td></tr></table>'; } else { result4.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Running Shorts</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B003ZFPO4Y&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B0038A37RC&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>The basic element of any runner's wardrobe. Usually a nylon or technical fiber.</td></tr></table>'; } if(chill<43){ if(cond=="Rain"){ result6.innerHTML = ''; } else { result6.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Running Gloves</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B005SW31W4&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B002LFWNK2&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></iframe></td><td>To keep your hands warm on a cold day. Mittens keep your hands warmer when temperatures drop below 30?. When in doubt, better to take your gloves with you. They're easy to tuck in your shorts or tights.</td></tr></table>'; } } else { result6.innerHTML = ''; } if(cond=="Sun"){ result7.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Sunglasses</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B000R2YR5U&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B002EL30O6&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>By keeping the sun out of your eyes, a good pair of sunglasses can save you energy by allowing you to relax your face (no squinting). Though their uses are obvious on sunny summer days, they're also useful on bright winter days, or any other time when glare is likely to be an issue.</td></tr></table>'; if(chill<60){ result8.innerHTML = ''; } else { result8.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Sunblock</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B001R1TWAA&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B003II53Z8&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>A must for sunny days, sunblock will actually keep you cooler, as well as preventing sunburn and reducing your risk of skin cancer. Use at least SPF-30; higher doesn't hurt. Also, use plenty. Applying sunblock too thinly reduces its effectiveness.</td></tr></table>'; } } else { result7.innerHTML = ''; result8.innerHTML = ''; } if(chill<90){ result9.innerHTML = ''; } else { result9.innerHTML = '<table><tr><td><b>Women</b></td><td><b>Men</b></td><td><b>Hydration</b></td></tr><tr><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B005VUR6N8&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td><iframe src="http://rcm.amazon.com/e/cm?t=garu-20&o=1&p=8&l=as1&asins=B000RJHU98&ref=qf_sp_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></td><td>On hot days it is critical to keep hydrated. Carrying a hydration pack will help on those long runs.</td></tr></table>'; } } }; </script>
Recent Comments