JavaScript calls pop-up layer specific instance code multiple times with page _javascript tips

Source: Internet
Author: User
Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Click 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:380px;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;}
. tcinp{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>
<body>
<!--first set up 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>
1111111111111111111111111</p>
<div class= "Miaosu" >
222222222222222222222222222222222222222222222222222
</div>
<div class= "Fomdiv" >
<span> Mobile Number: </span><input name= "" class= "Tcinp" type= "text"/></div>
<div class= "Popbutdiv" >
<input name= "button" type= "Submit" class= "Pop_but" id= "button" value= "Submit"/></div>
<p class= "Pop_p" >
1. The network is busy when there will be delays, please do not in a short period of time repeatedly sent <br/>
2. Each mobile phone number can receive 5 real estate information on the same day
</p>
</div>
</div>
</div>
<!--the button:--> 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>
333333333333333333333333333333</p>
<div class= "Miaosu" >
444444444444444444444444444444
</div>
<div class= "Fomdiv" >
<span> Mobile Number: </span><input name= "" class= "Tcinp" type= "text"/></div>
<div class= "Popbutdiv" >
<input name= "button" type= "Submit" class= "Pop_but" id= "button" value= "Submit"/></div>
<p class= "Pop_p" >
1. The network is busy when there will be delays, please do not in a short period of time repeatedly sent <br/>
2. Each mobile phone number can receive 5 real estate information on the same day
</p>
</div>
</div>
</div>
<!--the button:--> 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>
</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.