[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I get a newline in a messagebox alert?

Posted on 2006-06-22
7
Medium Priority
?
1,571 Views
Last Modified: 2012-08-14
I have an ASP.NET web application that is using javascript to create messageboxes (see below)
<script language=JavaScript>alert(. . .

How do I get a newline in the messagebox?  Simply inserting a newline (as in controlchars.newline in ASP.NET) doesn't work.
0
Comment
Question by:stev0931
  • 3
  • 3
7 Comments
 
LVL 26

Accepted Solution

by:
DireOrbAnt earned 420 total points
ID: 16963789
Use \n as in:
alert('Hello!\nHow are you?')
0
 
LVL 10

Assisted Solution

by:0h4crying0utloud
0h4crying0utloud earned 80 total points
ID: 16964003



really? that always worked fine for me. even now with a quick test in IE and FF

Is is possible those chars are geting removed somewhere else?  you might wanna try using a double back slash "\\n" wherever you put in the newline.  
0
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 16964059
I was giving stev0931 the solution, not showing what he tried :)
Simply use \n inside single quoted strings and you should be fine :)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:0h4crying0utloud
ID: 16964125

oh those line were so close together I thought they were the same messsage!!! my eyes are going!
0
 

Author Comment

by:stev0931
ID: 16964223
The \n worked!  Thanks!
0
 
LVL 10

Expert Comment

by:0h4crying0utloud
ID: 16964658

Dang, I owe you DireOrb.
0
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 16965113
No sweat. It's out of my control :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question