views:

239

answers:

4

With alerts you can have text inputs. I was hoping you could put check boxes in. Is this possible?

http://www.w3schools.com/JS/js_popup.asp

+7  A: 

No, you would need to build out a dialog box in order to achieve this.

You are able to achieve this with relative ease through jQuery and more specifically the jQuery UI plugin, allowing dialog boxes to come up without too much know-how

jakeisonline
jQuery UI has a brilliant one. It's just a shame the UI framework is so huge. Oh well, needs must.
Ben Shelock
It is indeed huge. Once you become more advanced with JavaScript or jquery, you'll be able to produce your own stuff like dialogs with 1/5 of the code - frameworks certainly do help make life easier, though :)
jakeisonline
+5  A: 

No. The only options are:

  • alert (display string);
  • confirm (display string and get yes/no|true/false back);
  • prompt (display string and get input string back)

You can create your own modal dialog using a variety of techniques. Under the hood, they all essentially do the same thing - display a separate web page in a popup window or iFrame and disable input access to the rest of the browser until the popup is closed. These are pretty easy to get wrong (hard to use + very annoying) but when done right they offer the developer a lot of power - since it's a complete web page you control, you can pass complex JavaScript objects between the dialog and the main browser window, instead of having to rely on the primitive interaction modes offered by the out-of-the-box dialogs.

Rex M
@anon why the DV?
Rex M
+3  A: 

Pretty shure it isn't possible. However, you can simulate a "alert box" with the contents you need. JQuery, for example, is a great javascript framework to achieve that.

yoda
why the downvote?
yoda
All the answers got downed, no one ever bothered commenting why.
jakeisonline
strange .. wonder why people does that ..
yoda
Spelling perhaps :)
Ben Shelock
+1  A: 

no, but you can create a function that opens a alert box with html in it, like on facebook.

Jcubed