user1360809
user1360809

Reputation: 745

JavaScript interactive form in alert box?

Is it possible to put a form into an alert box and then display that to the user? Afterwards I would want to submit the data but I presume it would work the same via a 'POST' method or such.

I had a quick play around but couldn't get it to work, not much on search engines either.

Thanks for any help!

Upvotes: 1

Views: 9383

Answers (4)

Alex W
Alex W

Reputation: 38213

If it's just a single input, you can use the built-in prompt() method.

Otherwise, you would have to pop up your own form.

Upvotes: 0

Zbarcea Christian
Zbarcea Christian

Reputation: 9548

I would recommend you jquery shadow: http://www.htmldrive.net/items/show/650/jQuery-Custom-PopUp-Window.html

Or if you want you can develop your own form (html, design, css, javascript).

Upvotes: 0

ced-b
ced-b

Reputation: 4065

You could use jQuery UI's dialog. This allows you to turn a DIV into a pop-up box.

Upvotes: 0

CodeBeard
CodeBeard

Reputation: 515

An alert box is not editable. You can use javascript to create a new browser window with your form in it.

General form is like this: window.open('url to open','window name') You will fall foul of popup blockers if you handle 'when' you do this badly.

This is quite a nice simple walk through with live examples http://www.pageresource.com/jscript/jwinopen.htm

Upvotes: 3

Related Questions