When I call display() function from switch statement, the display function doesn't work. Please help.
<script> var SN = document.getElementById('serialno'); var header = document.getElementById('header'); var trfLocation = document.getElementById('trfLocation'); var trfSupplyTo = document.getElementById('trfSupplyTo'); var trfPower = document.getElementById('trfPower'); var trfVoltage = document.getElementById('trfVoltage'); function transformer(location, supplyTo, power, voltage) { this.location = location; this.supplyTo = supplyTo; this.power = power; this.voltage = voltage; } function validate() { if (SN.value == '' || SN.value == null) { alert('Enter a serial no.'); } else { switch (SN.value) { // FOR C882 case '180384': var TRF = new transformer('C882 TRF1', '22kV Surface RMU1', '3000kVA', '22kV/11kV'); display(); break; case '180383': var TRF = new transformer('C882 TRF2', '22kV Surface RMU2', '3000kVA', '22kV/11kV'); display(); break; case '180385': var TRF = new transformer('C882 TRF3', '2800A LVMSB', '2000kVA', '22kV/415V'); display(); break; default: trfLocation.innerHTML = 'Transformer with serial no.' + SN.value + ' does not exit in project.'; } } } function display() { header.innerHTML = "The transformer with serial no." + SN.value + " details are as follow:"; trfLocation.innerHTML = "Transfomer Location: " + TRF.location; trfSupplyTo.innerHTML = "Serving To: " + TRF.supplyTo; trfPower.innerHTML = "Power: " + TRF.power; }