views:

61

answers:

2

I want to know whether i can create <div> at runtime using JavaScript or any other method: when clicking a button on one <div> another <div> should appear, and both <div>s should lay above the html page below (i.e floating <div>s).

+1  A: 

Here http://docs.jquery.com/UI/Dialog

Overview

A dialog is a floating window that contains a title bar and a content area. The dialog window can be moved, resized and closed with the 'x' icon by default.

If the content length exceeds the maximum height, a scrollbar will automatically appear.

A bottom button bar and semi-transparent modal overlay layer are common options that can be added.

mplungjan
+3  A: 

Yes, document.createElement("div"). For appending it where you want it, it's theParentElementYouWantToAppendTo.appendChild(theDivYouCreated).

Edit: And for the floating thing, do theDivYouCreated.style.position = "fixed".

Eli Grey
zIndex? Floating?
mplungjan