#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    10
    Rep Power
    0

    Basic questions on the javascript prompt


    i got this in my code and it prompts the user to enter their name.

    prompt('What is your name?','name');

    1) how i can put a message in the dialog box's title bar
    2)how can i get rid of the "javascript prompt:" message in the main body
    3) how can i make it so the cancel button when clicked will send you to a specific html

    thanx in advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2001
    Posts
    765
    Rep Power
    13
    var HTML = '', username = null, start;
    username = prompt('What is your name?','name');
    if (username != null)
    HTML += '<span id="hello" style="left:-200px;font-size:2px;">Hi '+ username+ ' ! Welcome to our Homepage!</span>';
    else location = url;

    http://www.dardenhome.com/js/x333491.htm
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    San Francisco, CA
    Posts
    226
    Rep Power
    13
    1 & 2) I'm 99% sure you can't change the title bar in the dialog box or the javascript prompt: in the main body.

    3) When the user clicks Cancel, prompt() returns null. So if you assign a var to prompt() ie:

    var result = prompt('What is your name?','name');

    check for null in result, and then direct the user to the appropriate page.


    Edit: I didn't mean to repeat what mrrichardfeder wrote, but rather than delete this post, I thought it might help to leave it.
    Last edited by Cira9999; April 14th, 2003 at 03:29 PM.
    -Samantha

IMN logo majestic logo threadwatch logo seochat tools logo