Alert box failure

M

micahl0180

I am trying to get an alert box with line breaks in it. I want to display a
couple pieces of information, and want them broken up. I tried using \n to
get a new line, but kept getting errors in my code. Any suggections?

Thanks in advance,

ML

alert("The combination you have selected: " + \n + "Background Color: " +
color1 + \n + "Text Color: " + color2)

Of course color1 and color2 have been declared and defined, so I know there
isn't an error there. Any suggections would be greatly appreicated.

Thanks again.
 
M

Matt Kruse

micahl0180 said:
I am trying to get an alert box with line breaks in it.

The \n should go _inside_ the quotes.
alert("The combination you have selected: " + \n + "Background Color: " +
color1 + \n + "Text Color: " + color2)

alert("The combination you have selected: \nBackground Color: " + color1 +
"\nText Color: " + color2)
 
W

William Morris

The idea is right, but the syntax is wrong. Put the \n character inside the
quotes as part of the string.

alert("The combination you have selected: \nBackground Color: " + color1 +
"\nText Color: " + color2)


--
William Morris
Semster, Seamlyne reProductions
Visit our website, http://www.seamlyne.com, for the most comfortable
historically inspired clothing you can buy!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top