This is a JavaScript calculator how calculate with the ohm's law the voltage, ampere and the resistance.Its only an example but feel free to copy change or reuse this script.
Try it:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
<script> function Berechne() { if(document.Eg.I1.value != "" && document.Eg.I2.value != "") {document.Eg.IG.value = 1*document.Eg.I1.value + document.Eg.I2.value*1;} if(document.Eg.IG.value != "" && document.Eg.I1.value != "") {document.Eg.I2.value = 1*document.Eg.IG.value - document.Eg.I1.value*1;} if(document.Eg.IG.value != "" && document.Eg.I2.value != "") {document.Eg.I1.value = 1*document.Eg.IG.value - document.Eg.I2.value*1;} if(document.Eg.R1.value != "" && document.Eg.R2.value != "") {document.Eg.RG.value = 1/(1/document.Eg.R1.value + 1/document.Eg.R2.value); document.getElementById("F1").style.backgroundColor = "#00FF00"; }else{document.getElementById("F1").style.backgroundColor = "#FF0000";} if(document.Eg.R2.value != "" && document.Eg.RG.value != "") {document.Eg.R1.value = -1/(1/document.Eg.R2.value-1/document.Eg.RG.value); document.getElementById("F2").style.backgroundColor = "#00FF00"; }else{document.getElementById("F2").style.backgroundColor = "#FF0000";} if(document.Eg.R1.value != "" && document.Eg.RG.value != "") {document.Eg.R2.value = -1/((1/document.Eg.R1.value)-(1/document.Eg.RG.value)); document.getElementById("F3").style.backgroundColor = "#00FF00"; }else{document.getElementById("F3").style.backgroundColor = "#FF0000";} if(document.Eg.I2.value != "" && document.Eg.R1.value != ""&& document.Eg.R2.value != "") {document.Eg.I1.value = (document.Eg.I2.value*document.Eg.R1.value)/document.Eg.R2.value; document.getElementById("F4").style.backgroundColor = "#00FF00"; }else{document.getElementById("F4").style.backgroundColor = "#FF0000";} if(document.Eg.I1.value != "" && document.Eg.R1.value != ""&& document.Eg.R2.value != "") {document.Eg.I2.value = (document.Eg.I1.value*document.Eg.R2.value)/document.Eg.R1.value; document.getElementById("F5").style.backgroundColor = "#00FF00"; }else{document.getElementById("F5").style.backgroundColor = "#FF0000";} if(document.Eg.I1.value != "" && document.Eg.I2.value != ""&& document.Eg.R2.value != "") {document.Eg.R1.value = (document.Eg.I1.value*document.Eg.R2.value)/document.Eg.I2.value; document.getElementById("F6").style.backgroundColor = "#00FF00"; }else{document.getElementById("F6").style.backgroundColor = "#FF0000";} if(document.Eg.I1.value != "" && document.Eg.I2.value != ""&& document.Eg.R1.value != "") {document.Eg.R2.value = (document.Eg.I2.value*document.Eg.R1.value)/document.Eg.I1.value; document.getElementById("F7").style.backgroundColor = "#00FF00"; }else{document.getElementById("F7").style.backgroundColor = "#FF0000";} if(document.Eg.RG.value != "" && document.Eg.UG.value != "") {document.Eg.IG.value = document.Eg.UG.value/document.Eg.RG.value; } if(document.Eg.IG.value != "" && document.Eg.R1.value != "" && document.Eg.R2.value != "") {document.Eg.I2.value = (document.Eg.IG.value/(document.Eg.R1.value*1+document.Eg.R2.value*1))*document.Eg.R1.value; document.getElementById("F8").style.backgroundColor = "#00FF00"; }else{document.getElementById("F8").style.backgroundColor = "#FF0000";} if(document.Eg.IG.value != "" && document.Eg.R2.value != "" && document.Eg.R2.value != "") {document.Eg.I1.value = (document.Eg.IG.value/(document.Eg.R1.value*1+document.Eg.R2.value*1))*document.Eg.R2.value; document.getElementById("F9").style.backgroundColor = "#00FF00"; }else{document.getElementById("F9").style.backgroundColor = "#FF0000";} } </script> <form name="Eg"> <br> <label>R1 :</label> <input type="text" name="R1"> <br> <label>R2 :</label> <input type="text" name="R2"> <br> <label>RG :</label> <input type="text" name="RG"> <br> <label>I1 :</label> <input type="text" name="I1"> <br> <label>I2 :</label> <input type="text" name="I2"> <br> <label>IG :</label> <input type="text" name="IG"> <br> <label>UG :</label> <input type="text" name="UG"> <br> <input type="button" onclick="javascript:Berechne()" value="Berechne"> <br> <br> <table id="tom" width="20%" border="2"> <colgroup> <col width="4*"> <col width="2*"> <col width="1*"> </colgroup> <tbody> <tr bgcolor="#E1E1E1" onmouseout="this.bgColor='#E1E1E1'" onmouseover="this.bgColor='#CCCCFF'"> <td id="F1">RG=1/(1/R1+1/R2)</td> </tr> <tr bgcolor="#E1E1E1" onmouseout="this.bgColor='#E1E1E1'" onmouseover="this.bgColor='#CCCCFF'"> <td id="F2">R1=-1/(1/R2-1/RG)</td> </tr> <tr bgcolor="#E1E1E1" onmouseout="this.bgColor='#E1E1E1'" onmouseover="this.bgColor='#CCCCFF'"> <td id="F3">R2=-1/(1/R1-1/RG)</td> </tr> <tr bgcolor="#E1E1E1" onmouseout="this.bgColor='#E1E1E1'" onmouseover="this.bgColor='#CCCCFF'"> <td id="F4">I1=(I2*R1)/R2</td> </tr> <tr bgcolor="#E1E1E1" onmouseout="this.bgColor='#E1E1E1'" onmouseover="this.bgColor='#CCCCFF'"> <td id="F5">I2=(I1*R2)/R1</td> </tr> <tr bgcolor="#E1E1E1" onmouseout="this.bgColor='#E1E1E1'" onmouseover="this.bgColor='#CCCCFF'"> <td id="F6">R1=(I1*R2)/I2</td> </tr> <tr bgcolor="#E1E1E1" onmouseout="this.bgColor='#E1E1E1'" onmouseover="this.bgColor='#CCCCFF'"> <td id="F7">R2=(I2*R1)/I1</td> </tr> <tr bgcolor="#E1E1E1" onmouseout="this.bgColor='#E1E1E1'" onmouseover="this.bgColor='#CCCCFF'"> <td id="F8">I2=(IG/(R1+R2))*R1</td> </tr> <tr bgcolor="#E1E1E1" onmouseout="this.bgColor='#E1E1E1'" onmouseover="this.bgColor='#CCCCFF'"> <td id="F9">I1=(IG/(R1+R2))*R2</td> </tr> </tbody> </table> </form> |
Greetings! I’ve been following your website for a very long time
now and lastly got the courage to just offer you a shout out of Houston Texas!
Just planned to let you know maintain the good work!