The specific instance code of the pop-up layer is called multiple times on the same page in javascript.

Source: Internet
Author: User

Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> click the text pop-up layer </title>
<Style type = "text/css">
<! --
* {Font-size: 12px; font-family: Verdana, Geneva, sans-serif; line-height: 14px}
P {margin: 0px; padding: 0px ;}
A {color: #039}
A: hover {color: # f60}
. Pop {position: absolute; left: 40px; top: 20px; width: pixel PX; height: 240px; background: # fff; border: 8px solid # DDD ;}
. Pop_head {position: relative; height: 18px ;}
. Pop_head img {border: none; margin: 8px 0px 0 0 ;}
. Pop_head a {position: absolute; right: 8px; line-height: 20px; color: #000; text-decoration: none}
. Pop_head a: hover {color: # f60; text-decoration: none}
. Pop_body {padding: 0 12px 2px}
. Popdiv {display: block; width: 12px; height: 20px ;}
. Popdiv img {border: none ;}
. Popbox {position: relative; height: 360px; width: 680px ;}
. Border {border: solid 1px # 8e8e8e; height: 240px}
. Miaosu {line-height: 16px; background: # fff6ea; border: solid 1px # ffecd5; padding: 4px 8px; color: #666; margin-top: 5px ;}
. Fomdiv {margin-top: 12px ;}
. Fomdiv span {display: block; float: left; line-height: 32px; font-size: 14px; color: #444 ;}
. Tcindium {width: 160px; height: 26px; border: solid 1px # DDD; font-size: 14px; padding-left: 5px; line-height: 26px ;}
. Pop_but {background: url (images/tbg.jpg) no-repeat; width: 69px; height: 29px; border: none; color: # fff; text-align: center; line-height: 29px; cursor: pointer}
. Popbutdiv {margin: 8px 0 16px 74px ;}
. Pop_p {line-height: 16px; color: #888; padding-top: 5px; border-top: dashed 1px # CCC ;}
-->

</Style>
</Head>
<Body>
<! -- First set a layer: -->
<Div class = "popbox">
<Div id = "pop" class = "pop" style = "display: none">
<Div class = "border">
<Div class = "pop_head">
<A href = "javascript: void (0);" onclick = "hide ()">
</a> </div>
<Div class = "pop_body">
<P>
</P> 1111111111111111111111111
<Div class = "miaosu">
222222222222222222222222222222222222222222222222222
</Div>
<Div class = "fomdiv">
<Span> mobile phone number: </span> <input name = "" class = "tcindium" type = "text"/> </div>
<Div class = "popbutdiv">
<Input name = "button" type = "submit" class = "pop_but" id = "button" value = "submit"/> </div>
<P class = "pop_p">
1. There is a delay when the network is busy. Please do not send it multiple times in a short time <br/>
2. Each mobile phone number can receive 5 real estate information on the same day
</P>
</Div>
</Div>
</Div>
<! -- The button for the pop-up layer: -->
<A href = "javascript: void (0);" onclick = "show ();" class = "popdiv">
</a>
</Div>
<Div class = "popbox">
<Div id = "pop2" class = "pop" style = "display: none">
<Div class = "border">
<Div class = "pop_head">
<A href = "javascript: void (0);" onclick = "hide2 ()">
</a> </div>
<Div class = "pop_body">
<P>
</P> 333333333333333333333333333333
<Div class = "miaosu">
444444444444444444444444444444
</Div>
<Div class = "fomdiv">
<Span> mobile phone number: </span> <input name = "" class = "tcindium" type = "text"/> </div>
<Div class = "popbutdiv">
<Input name = "button" type = "submit" class = "pop_but" id = "button" value = "submit"/> </div>
<P class = "pop_p">
1. There is a delay when the network is busy. Please do not send it multiple times in a short time <br/>
2. Each mobile phone number can receive 5 real estate information on the same day
</P>
</Div>
</Div>
</Div>
<! -- The button for the pop-up layer: -->
<A href = "javascript: void (0);" onclick = "show2 ();" class = "popdiv">
</a>
</Div>
<Script type = "text/javascript">
Var EX = {
AddEvent: function (k, v ){
Var me = this;
If (me. addEventListener)
Me. addEventListener (k, v, false );
Else if (me. attachEvent)
Me. attachEvent ("on" + k, v );
Else
Me ["on" + k] = v;
},
RemoveEvent: function (k, v ){
Var me = this;
If (me. removeEventListener)
Me. removeEventListener (k, v, false );
Else if (me. detachEvent)
Me. detachEvent ("on" + k, v );
Else
Me ["on" + k] = null;
},
Stop: function (evt ){
Evt = evt | window. event;
Evt. stopPropagation? Evt. stopPropagation (): evt. cancelBubble = true;
}
};
Document. getElementById ('pop'). onclick = EX. stop;
Var url = '#';
Function show (){
Var o = document. getElementById ('pop ');
O. style. display = "";
SetTimeout (function () {EX. addEvent. call (document, 'click', hide );});
}
Function hide (){
Var o = document. getElementById ('pop ');
O. style. display = "none ";
EX. removeEvent. call (document, 'click', hide );
}
Function show2 (){
Var o = document. getElementById ('pop2 ');
O. style. display = "";
SetTimeout (function () {EX. addEvent. call (document, 'click', hide2 );});
}
Function hide2 (){
Var o = document. getElementById ('pop2 ');
O. style. display = "none ";
EX. removeEvent. call (document, 'click', hide2 );
}
</Script>
</Body>
</Html>
</Td>
</Tr>
</Table>

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.