PDA

View Full Version : beginner javascript question



JasonChan
18 Jan 2007, 01:51 AM
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>

Arkette
18 Jan 2007, 03:42 AM
Document.write("<br />")

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