For a school project I have to create a virtual tamagotchi. When the page loads, it is set to a "happy" state. If you try to feed it when it is not hungry, I have an alert box up that says "I'm not hungry." The problem, however, is that when you click "OK" in the alert box, it refreshes the page, and the state is set back to "happy." The biggest problem with this is that, if the tamagotchi dies, you can just feed it, it says it is not hungry, and then it magically comes back to life in it's "happy" state. Is there a way I can have some sort of alert that doesn't refresh the page, or stop the alert from refreshing the page?