A variable is a temporary holder of information, such as the user’s selection in a drop-down box. Using variables clarifies the programming logic, making it easier to troubleshoot. The table below lists the characteristics of a variable.
This exercise uses a variable to hold the user’s selection (the first line of the script from the preceding exercise). A variable can be declared in one statement and the value assigned in another:
or the statements can be combined:
var Selection=Territory.Item(Territory.SelectedIndex);