pencilCake pencilCake - 8 months ago 17
HTML Question

How can I align a new line in a confirm pop-up window? (JavaScript )

On an html page, how can I align the 'warning' line in the below confirm call, to appear in the middle of the pop-up window?

confirm('You are about to delete 5 rows. \nWARNING: Strawberry cakes won\'t be effected!');


You can't. The confirm() window style (including dimensions) can vary between browsers and operating systems and you can't be sure of the font used either.

You might be better off using something like jQueryUI to create a seemingly modal dialog window to replace confirm() with something that looks better and integrates more with the look and feel of your site. (Demo here).