Basically i just hold any metal part of the computer and then touch the radiator to get rid of any static. probably not the way it should be done but it is the way that i do it. maybe wait and see what others do.
To clear yourself of static through touching the framework of the computer the power should be switched off as suggested, but you also need to have the power cord plugged into the power outlet to act as the earth. I myself touch one of the screws that retains the expansion cards as the chassis itself may be insulated by paint.
Another thing to remember is that once you remove the battery all settings will be reset in the BIOS. It might be a good idea to record the BIOS settings before starting, you may need to re-enter some settings in order to get your machine working correctly after replacing the battery. I took a picture of each screen of the BIOS with the camera on my phone, easier than writing all the settings down.
During my computer course, I was told that earthing the PC is not required - as long as you touch the metalwork (or use a wrist strap) you and the PC will be at the same potential and therefore no discharge can occur.