www.webdeveloper.com
Results 1 to 8 of 8

Thread: Javascript Prompt Wrong Outcome?

Threaded View

  1. #1
    Join Date
    Aug 2008
    Posts
    31

    Javascript Prompt Wrong Outcome?

    Hello, I want to be able to click a link and have a input prompt pop up followed by an alert and then right the contents of the prompt to a specific spot. heres my code so far:

    Code:
    <html>
    <head>
    
    <script language="JavaScript">
    function firstName() {
    var name = prompt ("Please Enter Your Name");
    alert('blah blah blah');
    }
    </script>
    
    </head>
    <body>
    
    <a href="#blah" onClick="firstName()">Click</a>
    
    <script language="JavaScript">document.write(name);</script>
    
    </body>
    </html>
    but my problem is when I type something in, and hit ok on the prompt and ok on the alert, the output is "m" and then some random numbers. can i possibly fix this?
    Last edited by bholtiphone; 11-19-2008 at 12:20 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles