tags:

views:

36

answers:

2

How do you print onto seperate lines like in Java with println?

<script language = "javascript">

                    document.write("Your name is:" + fullName);

                    document.write("You were born in:" + birthYear);

                    document.write("You already had your birthday this year");

                    document.write("Your age is an <i>even</i> number.");


        </script> 
+1  A: 

You need to print the data as html since that's the way a browser reads it. It's not like a console in Java. To make multiple lines you should use paragraph tags for each line or use a breake tag in the end.

document.write("<p>Your name is:" + fullName + "</p>");

document.write("Your name is:" + fullName + "<br />");
Mark Baijens