...

View Full Version : Prompt Box with Mutiple Messages



SyntaxError
08-31-2006, 03:17 AM
I'm trying to make a prompt where if a person types in their username, according to the name it will play a hello message with their name and have their own background.

The script so far looks like this, but I'm trying to make it work.

<script language="JavaScript">
name=prompt("Please Enter Your Name"");
if (name == "Ex1")
{
document.write("<html><head><title>Welcome " + name + "</title></head><body><EMBED src=\"sound1.ram\"><h1>Hello, " + name + "</body></html>");
}
if (name == "Ex2")
{
document.write("<html><head><title>Welcome " + name + "</title></head><body><EMBED src=\"sound2.ram\"><h1>Hello, " + name + "</body></html>");
}
if (name == "Ex3")
{
document.write("<html><head><title>Welcome " + name + "</title></head><body><EMBED src=\"sound2.ram\"><h1>Hello, " + name + "</body></html>");
}
//etc
}
</script>

If someone can figure this out, I thank you greatly,

Always,
SyntaxError

Wylie
08-31-2006, 07:45 AM
I only checked the first line. 1 careless error:)


name=prompt("Please Enter Your Name"");

SyntaxError
08-31-2006, 05:42 PM
Thank you for pointing that our, though now that I relook it should read:

name=prompt("Please Enter Your Name","");

Thank you, I apprecite that little look



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum