what kind of tamagotchi do you have? connection, connexion, or plus? i know on connection's the battery should be right underneath the first plastic plate you unscrewed. it's a round silver battery, like the kinds they put in watches. all you have to do is remove that battery and replace it with another watch battery of the same size, and then rescrew the backing on.
it may show an egg on the screen, but there's no need to panic. your tama didn't restart (unless you have an old 1997 version). all you have to do is press the 'B' button, and it should ask if you want to restart or download, and you choose download. it will take you back where your tama left off.
hope i helped out a little.