Simple and Easy-to-use Div pop-up layer, simple and easy-to-use Div pop-up layer
<Html>
<Head>
<Title> showdiv </title>
<! -- This is a style -->
<Style type = "text/css">
. Black_overlay {
Display: none;
Position: absolute;
Top: 0%;
Left: 0%;
Width: 100%;
Height: 100%;
Background-color: gray;
Z-index: 1001;
-Moz-opacity: 0.8;
Opacity: 0.5;/* Transparency --- value: [0.0, 1.0] */
Filter: alpha (opacity = 0.9 );
}
. White_content {
Display: none;
Position: fixed;
Top: 15%;
Left: 15%;
Width: 70%;
Height: 400px;
Padding: 1%;
Border: 1px solid lightblue;
Background-color: white;
Z-index: 1002;
Min-height: 400px;
}
. Btn {
Cursor: pointer;
}
</Style>
<Script type = "text/javascript">
// The hidden layer is displayed.
Function ShowDiv (show_div, bg_div ){
Document. getElementById (show_div). style. display = 'block ';
Document. getElementById (bg_div). style. display = 'block ';
Var bgdiv = document. getElementById (bg_div );
Bgdiv. style. width = document. body. scrollWidth;
$ ("#" + Bg_div). height ($ (document). height ());
// Bgdiv. style. height = $ (document). height ();
}
// Close the pop-up layer
Function CloseDiv (show_div, bg_div)
{
Document. getElementById (show_div). style. display = 'none ';
Document. getElementById (bg_div). style. display = 'none ';
};
</Script>
<Body>
<! -- Trigger button -->
<A onclick = "ShowDiv ('mainproduct', 'fade ')" class = "btn"> Open </a>
<! -- Display content -->
<Div id = "fade" class = "black_overlay"> This is the occlusion layer </div>
<Div id = "mainProduct" class = "white_content">
------ Fill in content ----- Part -------- can be a form
<Div class = "main" style = "width: 100%; height: 350px; overflow-y: scroll; overflow-x: hidden; border: 1px solid gray;">
Intermediate part <br/>
</Div>
<Div class = "bottom" style = "text-align: right; margin-bottom: 5px;">
<A class = "btn" onclick = "javascript: saveMainPro ();"> Save </a>
<A class = "btn" onclick = "CloseDiv ('mainproduct', 'fade ')"> Cancel </a>
</Div>
</Div>
</Body>
</Html>