First of all, look here:
http://www.codingforums.com/rules.htm
Look especially at rule 1.5.
If you make some realistic effort at doing your homework and come here asking for help getting past a bug or two, you'll likely get help.
But in this case... There's just no real code there that we can critique. We'd have to start all over.
I'm sorry, but it looks to me like you are just throwing code against a wall hoping that some of it may stick.
On top of all that, you are using ancient history JavaScript.
prompt and
document.write are both considered nothing but debugging tools nowadays and shouldn't be used in any real code, not even homework. If you instructor is seriously telling you to use those then he/she must not have been using real-world JavaScript any time in the last 10 years or so. I would complain to the department head about being taught such out-of-date coding techniques.