Results 1 to 2 of 2

Thread: beginner javascript question

  1. #1
    Join Date
    Sep 2006
    Posts
    14

    beginner javascript question

    Need some help fixing this. basically, i want the second document.write to start on a new line and i am using the "\n" escape code but it is not working. I tried putting the <pre> tag around the script and it still doesnt work. Whats going on here?

    <html>
    <head>
    <title>Javascript Run</title>

    </head>
    <body>

    <script type="text/javascript">
    var firstName = prompt("Please type in your name", "What is your first name?");
    var thirdLetter = firstName.charAt(2);

    alert("Hello "+firstName);


    document.write("The third letter of your name is "+thirdLetter\n);
    document.write("That is your character right ?");
    </script>


    </body>

    </html>

  2. #2
    Join Date
    Jan 2006
    Location
    Europe
    Posts
    92
    Document.write("<br />")

    Remember your using your javascript routine to spit out HTML, not text onto a page.

Similar Threads

  1. Help with javascript link question
    By emalen in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 23 May 2006, 06:30 AM
  2. Javascript question
    By Tharnid in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 23 Sep 2005, 07:54 AM

Posting Permissions

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