i have a few rather long winded functions in my javascript, which i'm assuming could be shrunk somehow, and would like to know if someone could suggest a way to make the code more compact...
the following function allows a select menu to populate a text field according to their values. i'd like to know if there's an easier, more compact way of writing this because i have about 600 lines like this on my form :-/
thanks in advance
Expand|Select|Wrap|Line Numbers
- function AddHiddenPrint(val)
- {
- if (val=="4x6_0"){
- document.IMAGECtrlForm.hidden4x6.value = "";}
- if (val=="4x6_1"){
- document.IMAGECtrlForm.hidden4x6.value = "1";}
- if (val=="4x6_2"){
- document.IMAGECtrlForm.hidden4x6.value = "2";}
- if (val=="4x6_3"){
- document.IMAGECtrlForm.hidden4x6.value = "3";}
- if (val=="4x6_4"){
- document.IMAGECtrlForm.hidden4x6.value = "4";}
- if (val=="4x6_5"){
- document.IMAGECtrlForm.hidden4x6.value = "5";}
- if (val=="4x6_6"){
- document.IMAGECtrlForm.hidden4x6.value = "6";}
- if (val=="4x6_7"){
- document.IMAGECtrlForm.hidden4x6.value = "7";}
- if (val=="4x6_8"){
- document.IMAGECtrlForm.hidden4x6.value = "8";}
- if (val=="4x6_9"){
- document.IMAGECtrlForm.hidden4x6.value = "9";}
- if (val=="4x6_10"){
- document.IMAGECtrlForm.hidden4x6.value = "10";}
- if (val=="4x6_11"){
- document.IMAGECtrlForm.hidden4x6.value = "11";}
- if (val=="4x6_12"){
- document.IMAGECtrlForm.hidden4x6.value = "12";}
- if (val=="4x6_13"){
- document.IMAGECtrlForm.hidden4x6.value = "13";}
- if (val=="4x6_14"){
- document.IMAGECtrlForm.hidden4x6.value = "14";}
- if (val=="4x6_15"){
- document.IMAGECtrlForm.hidden4x6.value = "15";}
- }