Admin DueLLoYöneticisi
Mesaj Sayısı : 928 Doğum tarihi : 06/07/90 Yaşı : 34 Nerden : Antalya İş/Hobiler : Webtasarım - Öğrenci Lakap : Site sahibi Rep Puanı : 735008
| Konu: Temperature Converter (ing) Cuma Ara. 04, 2009 8:08 pm | |
| - Kod:
-
<script type="text/javascript"> function convert(known) { if (known == "Cel") { var cel = document.theform.cel.value; var far = (cel * 1.8) + 32; far = Math.round(far * 1000) / 1000; var kel = 273 + Number(cel); kel = Math.round(kel * 1000) / 1000; document.theform.far.value = far; document.theform.kel.value = kel; } else if (known == "Far") { var far = document.theform.far.value; var cel = (far - 32) / 1.8; cel = Math.round(cel * 1000) / 1000; var kel = cel + 273 kel = Math.round(kel * 1000) / 1000; document.theform.cel.value = cel; document.theform.kel.value = kel; } else if (known == "Kel") { var kel = document.theform.kel.value; var cel = kel - 273; cel = Math.round(cel * 1000) / 1000; var far = (cel * 1.8) + 32; far = Math.round(far * 1000) / 1000; document.theform.cel.value = cel; document.theform.far.value = far; } } </script>
<form name='theform' action='javascript: void(0)'> <p><b>Fahrenheit:</b> <input type='text' name='far' onChange="convert('Far')" /></p> <p><b>Celcius:</b> <input type='text' name='cel' onChange="convert('Cel')" /></p> <p><b>Kelvin:</b> <input type='text' name='kel' onChange="convert('Kel')" /></p> <input type='submit' value='Convert!' /> </form> | |
|