The general pop-up page (compatible with IE and firefox) can disable the control width and height and mask the background.

Source: Internet
Author: User

<%... @ Page contentType = "text/html; charset = UTF-8" language = "java" import = "java. SQL. *" errorPage = "" %>
<% .../*
General pop-up page (compatible with IE and firefox)
Note:
1. openWindows (width, height) ---- open the function called by the pop-up layer to control the width and height of the layer
2. hiddenWindows () ---- close the function called at the pop-up layer
3. _ displaySelect () ---- hide the drop-down box label because it has a high priority.
4. <div id = "LockWindows"> ---- used to shield the pages below the pop-up layer
5. <div id = "WindowDIV"> ---- used to display the content of the pop-up layer
Example (remove spaces by yourself ):
Reference <% @ include file = "../common/common_openWindows.jsp" %>
<Input type = "button" onclick = "openWindows ('20160301', '20160301');" value = "edit"/>
<Input type = "button" onclick = "hiddenWindows ();" value = "close"/>
*/%>
Copy codeThe Code is as follows:
<Style type = "text/css">...
# LockWindows {...}{
Position: absolute; top: 10px; left: 10px; background-color: #777777; z-index: 2; display: none;
/** // * Use the private attribute Moz-opacity: 0.70 */
/** // * Use private attribute filter for IE */
/** // * The standard attribute opacity supports CSS3 browsers (also supported by FF 1.5 )*/
Opacity: 0.70;
Filter: progid: DXImageTransform. Microsoft. Alpha (style = 0, opacity = 70, finishOpacity = 100 );
Width: expression (documentElement. clientWidth <900? (DocumentElement. clientWidth = 0? (Body. clientWidth <900? '200': 'auto'): '900px '): 'auto ');
}
# WindowDIV {...} {position: absolute; z-index: 3; background-color: # FFFFFF; border: #000000 solid 1px; display: none ;}
</Style>

<Script type = "text/javascript">...
// Hide the drop-down box to solve the problem that the drop-down box has a high priority,
Copy codeThe Code is as follows:
Function _ displaySelect ()...{
Var selects = document. getElementsByTagName ("select"); // all the drop-down boxes on the entire page
Var objWindow = $ ("WindowDIV ");
Var DIVselects = objWindow. getElementsByTagName ("select"); // all the drop-down boxes of the entire pop-up layer
For (var I = 0; I <selects. length; I ++ )...{
If (selects [I]. style. visibility )...{
Selects [I]. style. visibility = "";
} Else ...{
Selects [I]. style. visibility = "hidden ";
For (var j = 0; I <DIVselects. length; j ++ )...{
DIVselects [j]. style. visibility = "";
}
}
}
}
Function openWindows (width, height )...{
Var objWindow = $ ("WindowDIV ");
Var objLock = $ ("LockWindows"); // This is used to block content in IE.
ObjLock. style. display = "block ";
ObjLock. style. width = document. body. clientWidth + "px ";
ObjLock. style. height = document. body. clientHeight + "px ";
ObjLock. style. minWidth = document. body. clientWidth + "px ";
ObjLock. style. minHeight = document. body. clientHeight + "px ";
// Determine whether the input width and height are greater than the width and height of the current Browser
If (width> document. body. clientWidth) width = document. body. clientWidth + "px ";
If (height> document. body. clientHeight) height = document. body. clientHeight + "px ";
ObjWindow. style. display = 'block ';
ObjWindow. style. width = width + "px ";
ObjWindow. style. height = height + "px ";
// Center the pop-up layer
ObjWindow. style. left = (document. body. offsetWidth-width)/2 + "px ";
ObjWindow. style. top = (document. body. offsetHeight-height)/2 + "px ";
_ DisplaySelect ();
}
Function hiddenWindows ()...{
$ ("LockWindows"). style. display = 'none ';
$ ("WindowDIV"). style. display = 'none ';
_ DisplaySelect ();
}
</Script>
<Div id = "LockWindows"> </div>
<Div id = "WindowDIV">
<%... @ Include file = "../examination/openEditerDiv. jsp" %>
</Div>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.