Electricity can kill, so it is very important to be careful while working with it and to use safety equipment. If you are not competent working around electricity have an electrician do the work.
Do It Yourself - Home Page
Three-way switches can be a little confusing because, unlike a standard switch,
they have three screw terminals and do not have ON-OFF markings. Three-way
switches are always installed in pairs and are used to control a set of lights
from two separate locations.
One of the screw terminals is darker than the others. This is the common screw
terminal. Before disconnecting a three-way switch, always label the wire that
is connected to the common screw terminal. It must be reconnected to the common
screw terminal on the new switch.
The two lighter-colored screw terminals are called the traveler screw
terminals. They are interchangeable so there is no need to label the wires
attached to them.
2 Steps
1. Safety alert: always turn off power at the main service panel before
attempting switch repairs or replacement. Connect the common wire
to the dark common screw terminal on the new switch. On most three-way
switches, the common screw terminal is copper (or it may be labeled with the
word COMMON stamped on the back of the switch).
2. Connect the remaining wires to the brass or silver "traveler" terminals.
These wires can be connected to either screw terminal. Carefully tuck the wires
into the box. Remount the switch, and attach the cover plate. Restore the power
at the main service panel.