[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How do I get a newline in a messagebox alert?

Posted on 2006-06-22
7
Medium Priority
?
1,570 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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?
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…

650 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