Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post

    Question Prompt Box with Mutiple Messages

    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

  • #2
    New Coder
    Join Date
    Aug 2006
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I only checked the first line. 1 careless error


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

  • #3
    New Coder
    Join Date
    Aug 2006
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •