Use js and css pop-up layers

Source: Internet
Author: User

<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> factly pop-up layer </title>
<Style type = "text/css">
<! --

. Tittleup {
Font-size: 14px;
Font-weight: bold;
Color: #000066;
Padding-left: 25px;
Border-bottom-width: 1px;
Border-bottom-style: solid;
Border-bottom-color: # d0daec;
Margin-bottom: 10px;
Padding-bottom: 10px;
}
. Od {
Float: right;
Font-size: 14px;
Color: # CC0000;
Text-decoration: none;
}
. Od: hover {
Color: # FF0000;
}
. Fd {
Background: # EDF1F8;
Border: 2px solid # 849BCA;
Margin-top: 2px;
Margin-left: 2px;
Float: left;
Overflow: hidden;
Position: absolute;
Left: 200px;
Top: 30px;
Z-index: 10;
}
. Contentup {
Padding: 20px;
}
}
-->
</Style>
</Head>
<Body>
<Div> <a href = "#" onclick = "show ('fd ', 650,300); return false;"> [open layer] </a> </div>
<Label>
<Select name = "select">
<Option> Haha </option>
<Option> Hahahaha </option>
<Option> Haha </option>
<Option> hahahahahahahahaha </option>
<Option> Haha </option>
<Option> Hahahaha </option>
<Option> Haha </option>
<Option> hahahahahahahahaha </option>
<Option> Haha </option>
<Option> Hahahaha </option>
<Option> Haha </option>
<Option> hahahahahahahahaha </option>
</Select>
</Label>
Aaaaaa
Aaaaa
Aaaaa
Aaaa
Aaaa
Aaaaaa
<Input name = "" type = "text">

<Label>
<Input type = "checkbox" name = "checkbox2" value = "checkbox">
</Label>

<Div id = "fd" class = "fd" style = "display: none; filter: alpha (opacity = 100); opacity: 1;">
<Div class = "contentup"> <a href = "#" class = "od" onclick = "closeed ('fd '); return false;">

Close </a>
<Div id = "tittleup" class = "tittleup"> factly Haha </div>
Kwg
<Label>
<Input type = "checkbox" name = "checkbox" value = "checkbox">
</Label>
<Input name = "" type = "text">
<Input name = "" type = "text">
<Input name = "" type = "text">
<Label> aaa
<Select name = "select">
<Option> Haha </option>
<Option> Hahahaha </option>
<Option> Haha </option>
<Option> hahahahahahahahaha </option>
<Option> Haha </option>
<Option> Hahahaha </option>
<Option> Haha </option>
<Option> hahahahahahahahaha </option>
<Option> Haha </option>
<Option> Hahahaha </option>
<Option> Haha </option>
<Option> hahahahahahahahaha </option>
</Select>
</Label>
</Div>
</Div>
<Script type = "text/javascript">
Var prox;
Var proy;
Var proxc;
Var proyc;
Var isIe = (document. all )? True: false;

Function setSelectState (state)
{
Var objl = document. getElementsByTagName ('select ');
For (var I = 0; I <objl. length; I ++)
{
Objl [I]. style. visibility = state;
}
}

// Close the window
Function closeWindow ()
{
If (document. getElementById ('back ')! = Null)
{
Document. getElementById ('back'). parentNode. removeChild (document. getElementById ('back '));
}
If (document. getElementById ('meswindow ')! = Null)
{
Document. getElementById ('meswindow'). parentNode. removeChild (document. getElementById ('meswindow '));
}
If (isIe)
{
SetSelectState ('');
}
}
/* -- Open Div --*/
/* Parameter description: id is the ID of the div, divWidth is the width of the pop-up layer, and divHeight is the height of the pop-up layer */
Function show (id, divWidth, divHeight)
{
CloseWindow ();
Var bWidth = parseInt (document. body. scrollWidth );
Var bHeight = parseInt (window. screen. height-document.body.scrollHeight );
If (isIe)
{
SetSelectState ('');
}
Var back = document. createElement ("div ");
Back. id = "back ";
Var styleStr = "top: 0px; left: 0px; position: absolute; background: # D9D9D9; width:" + bWidth + "px; height:" + bHeight + "px; ";
StyleStr + = (isIe )? "Filter: alpha (opacity = 40);": "opacity: 0.40 ;";
Back.style.css Text = styleStr;
Document. body. appendChild (back );
Var o = document. getElementById (id );
O. style. display = "block ";
O. style. width = "1px ";
O. style. height = "1px ";
Prox = setInterval (function () {openx (o, divWidth, divHeight)}, 10 );

}

/* -- Open x --*/
Function openx (o, openWidth, openHeight)
{

Var cx = parseInt (o. style. width );
If (cx <openWidth)
{
O. style. width = (cx + Math. ceil (openWidth-cx)/1) + "px ";
}
Else
{
ClearInterval (prox );
Proy = setInterval (function () {openy (o, openHeight)}, 10 );
}
}
Function openy (o, c) {/* -- open y --*/

Var cy = parseInt (o. style. height );
If (cy <c)
{
O. style. height = (cy + Math. ceil (c-cy)/10) + "px ";
}
Else
{
ClearInterval (proy );
}
}

/* -- Close Div --*/
Function closeed (id)
{
CloseWindow ();
ClearInterval (prox );
ClearInterval (proy );
ClearInterval (proxc );
ClearInterval (proyc );
Var o = document. getElementById (id );
If (o. style. display = "block ")
{
Proyc = setInterval (function () {closey (o)}, 10 );
}
}
/* -- Disable y --*/
Function closey (o)
{
Var cy = parseInt (o. style. height );
If (cy> 0)
{
O. style. height = (cy-Math. ceil (cy/10) + "px ";
}
Else
{
ClearInterval (proyc );
Proxc = setInterval (function () {closex (o)}, 10 );
}
}
/* -- Open x --*/
Function closex (o)
{
ClearInterval (proxc );
O. style. display = "none ";
}
</Script>

</Body>
</Html>

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.