Hi

I'm quite new to javascript and cannot figure this out.
I have a method that gets called onpropertychange by quite a number of controls to change text of other controls.

At the moment I just use an excessively long if-else statement to get this right.

If anyone knows a more proficient way of getting the same end result, please help.
It would be greatly appreciated.

Many thanks in advance!

Bellow is the method I'm currently using and would like to optimize.

function textChangedEvent(current, next) {

var a = null;

if (next == 'TextBoxAddShiftRulesStartTimeTuesday') {
a = document.getElementById('<%= TextBoxAddShiftRulesStartTimeTuesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesStartTimeWednesday') {
a = document.getElementById('<%= TextBoxAddShiftRulesStartTimeWednesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesStartTimeThursday') {
a = document.getElementById('<%= TextBoxAddShiftRulesStartTimeThursday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesStartTimeFriday') {
a = document.getElementById('<%= TextBoxAddShiftRulesStartTimeFriday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesStartTimeSaturday') {
a = document.getElementById('<%= TextBoxAddShiftRulesStartTimeSaturday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesStartTimeSunday') {
a = document.getElementById('<%= TextBoxAddShiftRulesStartTimeSunday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesStartTimePPH') {
a = document.getElementById('<%= TextBoxAddShiftRulesStartTimePPH.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesFinishTimeTuesday') {
a = document.getElementById('<%= TextBoxAddShiftRulesFinishTimeTuesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesFinishTimeWednesday') {
a = document.getElementById('<%= TextBoxAddShiftRulesFinishTimeWednesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesFinishTimeThursday') {
a = document.getElementById('<%= TextBoxAddShiftRulesFinishTimeThursday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesFinishTimeFriday') {
a = document.getElementById('<%= TextBoxAddShiftRulesFinishTimeFriday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesFinishTimeSaturday') {
a = document.getElementById('<%= TextBoxAddShiftRulesFinishTimeSaturday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesFinishTimeSunday') {
a = document.getElementById('<%= TextBoxAddShiftRulesFinishTimeSunday.ClientID %>');
}
else if (next == 'TextBoxAddShiftRulesFinishTimePPH') {
a = document.getElementById('<%= TextBoxAddShiftRulesFinishTimePPH.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsHoursTuesday') {
a = document.getElementById('<%= TextBoxAddDeductionsHoursTuesday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsHoursWednesday') {
a = document.getElementById('<%= TextBoxAddDeductionsHoursWednesday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsHoursThursday') {
a = document.getElementById('<%= TextBoxAddDeductionsHoursThursday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsHoursFriday') {
a = document.getElementById('<%= TextBoxAddDeductionsHoursFriday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsHoursSaturday') {
a = document.getElementById('<%= TextBoxAddDeductionsHoursSaturday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsHoursSunday') {
a = document.getElementById('<%= TextBoxAddDeductionsHoursSunday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsHoursPPH') {
a = document.getElementById('<%= TextBoxAddDeductionsHoursPPH.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsDeductTuesday') {
a = document.getElementById('<%= TextBoxAddDeductionsDeductTuesday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsDeductWednesday') {
a = document.getElementById('<%= TextBoxAddDeductionsDeductWednesday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsDeductThursday') {
a = document.getElementById('<%= TextBoxAddDeductionsDeductThursday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsDeductFriday') {
a = document.getElementById('<%= TextBoxAddDeductionsDeductFriday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsDeductSaturday') {
a = document.getElementById('<%= TextBoxAddDeductionsDeductSaturday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsDeductSunday') {
a = document.getElementById('<%= TextBoxAddDeductionsDeductSunday.ClientID %>');
}
else if (next == 'TextBoxAddDeductionsDeductPPH') {
a = document.getElementById('<%= TextBoxAddDeductionsDeductPPH.ClientID %>');
}
else if (next == 'TextBoxAddMinimumHoursTuesday') {
a = document.getElementById('<%= TextBoxAddMinimumHoursTuesday.ClientID %>');
}
else if (next == 'TextBoxAddMinimumHoursWednesday') {
a = document.getElementById('<%= TextBoxAddMinimumHoursWednesday.ClientID %>');
}
else if (next == 'TextBoxAddMinimumHoursThursday') {
a = document.getElementById('<%= TextBoxAddMinimumHoursThursday.ClientID %>');
}
else if (next == 'TextBoxAddMinimumHoursFriday') {
a = document.getElementById('<%= TextBoxAddMinimumHoursFriday.ClientID %>');
}
else if (next == 'TextBoxAddMinimumHoursSaturday') {
a = document.getElementById('<%= TextBoxAddMinimumHoursSaturday.ClientID %>');
}
else if (next == 'TextBoxAddMinimumHoursSunday') {
a = document.getElementById('<%= TextBoxAddMinimumHoursSunday.ClientID %>');
}
else if (next == 'TextBoxAddMinimumHoursPPH') {
a = document.getElementById('<%= TextBoxAddMinimumHoursPPH.ClientID %>');
}
else if (next == 'TextBoxAddPayHoursTuesday') {
a = document.getElementById('<%= TextBoxAddPayHoursTuesday.ClientID %>');
}
else if (next == 'TextBoxAddPayHoursWednesday') {
a = document.getElementById('<%= TextBoxAddPayHoursWednesday.ClientID %>');
}
else if (next == 'TextBoxAddPayHoursThursday') {
a = document.getElementById('<%= TextBoxAddPayHoursThursday.ClientID %>');
}
else if (next == 'TextBoxAddPayHoursFriday') {
a = document.getElementById('<%= TextBoxAddPayHoursFriday.ClientID %>');
}
else if (next == 'TextBoxAddPayHoursSaturday') {
a = document.getElementById('<%= TextBoxAddPayHoursSaturday.ClientID %>');
}
else if (next == 'TextBoxAddPayHoursSunday') {
a = document.getElementById('<%= TextBoxAddPayHoursSunday.ClientID %>');
}
else if (next == 'TextBoxAddPayHoursPPH') {
a = document.getElementById('<%= TextBoxAddPayHoursPPH.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMinTuesday') {
a = document.getElementById('<%= TextBoxAddShiftInMinTuesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMinWednesday') {
a = document.getElementById('<%= TextBoxAddShiftInMinWednesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMinThursday') {
a = document.getElementById('<%= TextBoxAddShiftInMinThursday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMinFriday') {
a = document.getElementById('<%= TextBoxAddShiftInMinFriday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMinSaturday') {
a = document.getElementById('<%= TextBoxAddShiftInMinSaturday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMinSunday') {
a = document.getElementById('<%= TextBoxAddShiftInMinSunday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMinPPH') {
a = document.getElementById('<%= TextBoxAddShiftInMinPPH.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMaxTuesday') {
a = document.getElementById('<%= TextBoxAddShiftInMaxTuesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMaxWednesday') {
a = document.getElementById('<%= TextBoxAddShiftInMaxWednesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMaxThursday') {
a = document.getElementById('<%= TextBoxAddShiftInMaxThursday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMaxFriday') {
a = document.getElementById('<%= TextBoxAddShiftInMaxFriday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMaxSaturday') {
a = document.getElementById('<%= TextBoxAddShiftInMaxSaturday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMaxSunday') {
a = document.getElementById('<%= TextBoxAddShiftInMaxSunday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInMaxPPH') {
a = document.getElementById('<%= TextBoxAddShiftInMaxPPH.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMinTuesday') {
a = document.getElementById('<%= TextBoxAddShiftOutMinTuesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMinWednesday') {
a = document.getElementById('<%= TextBoxAddShiftOutMinWednesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMinThursday') {
a = document.getElementById('<%= TextBoxAddShiftOutMinThursday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMinFriday') {
a = document.getElementById('<%= TextBoxAddShiftOutMinFriday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMinSaturday') {
a = document.getElementById('<%= TextBoxAddShiftOutMinSaturday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMinSunday') {
a = document.getElementById('<%= TextBoxAddShiftOutMinSunday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMinPPH') {
a = document.getElementById('<%= TextBoxAddShiftOutMinPPH.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMaxTuesday') {
a = document.getElementById('<%= TextBoxAddShiftOutMaxTuesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMaxWednesday') {
a = document.getElementById('<%= TextBoxAddShiftOutMaxWednesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMaxThursday') {
a = document.getElementById('<%= TextBoxAddShiftOutMaxThursday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMaxFriday') {
a = document.getElementById('<%= TextBoxAddShiftOutMaxFriday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMaxSaturday') {
a = document.getElementById('<%= TextBoxAddShiftOutMaxSaturday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMaxSunday') {
a = document.getElementById('<%= TextBoxAddShiftOutMaxSunday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutMaxPPH') {
a = document.getElementById('<%= TextBoxAddShiftOutMaxPPH.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutRoundToTuesday') {
a = document.getElementById('<%= TextBoxAddShiftOutRoundToTuesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutRoundToWednesday') {
a = document.getElementById('<%= TextBoxAddShiftOutRoundToWednesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutRoundToThursday') {
a = document.getElementById('<%= TextBoxAddShiftOutRoundToThursday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutRoundToFriday') {
a = document.getElementById('<%= TextBoxAddShiftOutRoundToFriday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutRoundToSaturday') {
a = document.getElementById('<%= TextBoxAddShiftOutRoundToSaturday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutRoundToSunday') {
a = document.getElementById('<%= TextBoxAddShiftOutRoundToSunday.ClientID %>');
}
else if (next == 'TextBoxAddShiftOutRoundToPPH') {
a = document.getElementById('<%= TextBoxAddShiftOutRoundToPPH.ClientID %>');
}
else if (next == 'TextBoxAddShiftInRoundToTuesday') {
a = document.getElementById('<%= TextBoxAddShiftInRoundToTuesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInRoundToWednesday') {
a = document.getElementById('<%= TextBoxAddShiftInRoundToWednesday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInRoundToThursday') {
a = document.getElementById('<%= TextBoxAddShiftInRoundToThursday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInRoundToFriday') {
a = document.getElementById('<%= TextBoxAddShiftInRoundToFriday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInRoundToSaturday') {
a = document.getElementById('<%= TextBoxAddShiftInRoundToSaturday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInRoundToSunday') {
a = document.getElementById('<%= TextBoxAddShiftInRoundToSunday.ClientID %>');
}
else if (next == 'TextBoxAddShiftInRoundToPPH') {
a = document.getElementById('<%= TextBoxAddShiftInRoundToPPH.ClientID %>');
}

if (a != null) {
a.value = current.value;
}

return false;
}