Jump to content

Pop-up box returns "undefined"


brooke_theperson

Recommended Posts

I have this as one of my switch statements as the default:

default:            document.getElementById("default2").innerHTML = window.alert("I don't know that color.");        break;

The pop-up box appears and says the message, but when I click "ok" the word "undefined" shows up on the screen. How do I make it so the box pops up, and when you click "ok" nothing shows up on the screen?

Edited by brooke_theperson
Link to comment
Share on other sites

Ok, that just makes no sense. Try...

default:        window.alert("I don't know that color.");        break;

...or...

default:        document.getElementById("default2").innerHTML = "I don't know that color";        setTimeout(function(){document.getElementById("default2").innerHTML = "";},5000);        break;
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...