//series / parallel resistor functions //copyright Simon Carter 2001-2003 //Please contact me via www.electronics2000.co.uk if you wish to use these //and ensure this header block remains intact var seriestotal=0; var paralleltotal=0; function seriesaddval (obj) { with (Math) { r=eval(obj.res_1.value); if(r > 0){ r=calculatemult1(obj.resmult_1.selectedIndex,r); seriestotal += r; obj.res_1.value = ""; SetText("restotal_1", format(seriestotal) + " Ohms"); calcseriespref(obj); } } } function calcseriespref(obj){ prefres_1 = format((GetPrefRes(seriestotal, getCheckedValue(obj.prefseries)))); SetText("prefrestotal_1", prefres_1 + " Ohms"); } function seriesreset (obj) { seriestotal = 0; obj.res_1.value = ""; SetText("restotal_1", "?"); SetText("prefrestotal_1", "?"); } function paralleladdval (obj) { with (Math) { rp=eval(obj.resp_2.value); if(rp > 0){ rp=calculatemult1(obj.respmult_2.selectedIndex,rp); paralleltotal += (1 / rp); obj.resp_2.value = ""; SetText("restotal_2", format((1 / paralleltotal)) + " Ohms"); calcparallelpref(obj) } } } function calcparallelpref(obj){ prefres_2 = format((GetPrefRes((1/paralleltotal), getCheckedValue(obj.prefseries)))); SetText("prefrestotal_2", prefres_2 + " Ohms"); } function parallelreset (obj) { paralleltotal = 0; obj.resp_2.value = ""; SetText("restotal_2", "?"); SetText("prefrestotal_2", "?"); } function parallelcalcr2 (obj) { HideTip("tipbox_3"); with (Math) { rt=calculatemult1(obj.rtotalmult_3.selectedIndex,eval(obj.rtotal_3.value)); r1=calculatemult1(obj.r1mult_3.selectedIndex,eval(obj.r1_3.value)); if (r1&&rt){ if(rt<0||r1<0||r1 0 and R1 > Total!"); SetText("r2_3", "?"); SetText("prefr2_3", "?"); } else{ r2 = (r1 * rt) / (r1 - rt); SetText("r2_3", format(r2) + " Ohms"); prefres_3 = format((GetPrefRes(r2, getCheckedValue(obj.prefseries)))); SetText("prefr2_3", prefres_3 + " Ohms"); } } else{ SetText("r2_3", "?"); SetText("prefr2_3", "?"); } } }