...

View Full Version : Writing on separate lines



mgm2010
06-26-2009, 06:11 AM
How can the output of the following code be written on separate lines ??


<script type = "text/javascript">
var x = 'Hello and Welcome'

document.write(x.length)
document.write(y.toUpperCase())

</script>

celsoendo
06-26-2009, 06:22 AM
Change this:



document.write(x.length)


for this:


document.write(x.length + '<br />')

Old Pedant
06-26-2009, 06:24 AM
Ummm...you mean lines in a browser?? Heard of HTML?

document.write( x.length + "<br/>" + y.toUpperCase() + "<br/>");

If you are trying to create a text file, instead of HTML:

document.write( x.length + "\n" + y.toUpperCase() + "\n");

mgm2010
06-26-2009, 06:35 AM
Many many thanks everyone!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum