by

Capacitor Code Calculator

Enter the two or three digit number on a capacitor and the capacitance value is calculated.

function cap_calc(){
var calc=document.getElementById(‘capform’);
var capnum=calc.capnum.value;
var capval=new String(“”);

if (capnum<100) { var capval=capnum.toString()+" pF" } if (capnum>=1000) {
var capval=”Invalid Number Code Entered”;
}
else {
var prefix = Math.floor(capnum/10)
var suffix = capnum-10*prefix;

if (suffix<=1) { var capval = (prefix*Math.pow(10,suffix)).toString()+" pF"; } else if (suffix<=4) { var capval=(prefix*Math.pow(10,suffix-3)).toString()+" nF"; } else if (suffix<=7) { var capval=(prefix*Math.pow(10,suffix-6)).toString()+" microF"; } else if (suffix<=9) { var capval=(prefix*Math.pow(10,suffix-9)).toString()+" mF"; } else { var capval="Invalid Number Code Entered"; } } calc.capval.value=capval; return false; }[/js]

Capacitor Number:
Capacitor Value:

 

Leave a Reply

Your email address will not be published. Required fields are marked *