Forums » .NET » JavaScript »

to print a new line in javascript


Posted Date: 30 Sep 2008      Posted By:: divakaran     Member Level: Bronze    Member Rank: 0     Points: 1   Responses: 3



how to print a value in new line in JavaScript, when all the values are stored in a single variable or string


Pls help me its urgent

Regards,
Divakarand




Responses

#302138    Author: sayyad baji      Member Level: Gold      Member Rank: 1849     Date: 30/Sep/2008   Rating: 3 out of 53 out of 53 out of 5     Points: 3

Hi divakaran,

if u want to give new line in javascript the code as follows:
<script language="javascript">
document.writeln("Hello");
document.write("Hi");
</script>

or use break tag <br> in the document.write("Hello <br>");

try both the things then u will solve that issue.

all the best


 
#302457    Author: Vidhya      Member Level: Gold      Member Rank: 0     Date: 01/Oct/2008   Rating: 3 out of 53 out of 53 out of 5     Points: 3

Hi,

refer the following code:
<script type="text/javascript">
var var1 = new Array();
var1[0] = "aaa";
var1[1] = "bbb";
var1[2] = "ccc";
for (i=0;i<var1.length;i++)
{
document.write(var1[i] + "<br />");
}
</script>

output:
aaa
bbb
ccc

Hope this helps you!
Happy programming!

Regards,
Vidhya

Note:
Kindly rate this content if it really helps you!


 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Code for Voting
Previous : while uploading images need to validate width and height
Return to Discussion Forum
Post New Message
Category: JavaScript

Related Messages

Subscribe to Subscribers
Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India