How To Stylize Text In An Alert Box?
Solution 1:
Basically it's impossible. You don't have access to OS level from inside the browser.
All you can do is using a custom modal popup. You can find tons of ready to use modal popup plug ins here or here
window.alert
accept an string
as it's argument. You can't style an string
From MDN:
message is a
string
of text you want to display in the alert dialog, or, alternatively, an object that is converted into a string and displayed.
Solution 2:
The alert box is a browser window and part of the OS, not the DOM, so unfortunately you can't apply styles to it.
The easiest solution is to use one of many existing modal dialogs along with the required Javascript library of the dialog you choose.
The alternative is to mimic an alert box by overlaying a specialized <div class="yourAlertClass">
on your page, using Javascript or a custom library (like moo tools or jQuery) for the animations.
Solution 3:
You can't.
I think what you are thinking of is a modal popup. Have a look in JQuery UI, but there are plenty of other libraries you can use.
Post a Comment for "How To Stylize Text In An Alert Box?"