JavaScript Pop-up layer Instance code

Source: Internet
Author: User

 <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http:// "

&lt;html xmlns= "" &gt; &lt;head&gt; &lt;meta http-equiv= "Content-type" content= "text/" html Charset=utf-8 "/&gt; &lt;title&gt; window &lt;/title&gt; &lt;style type=" Text/css "&gt; body{margin:0;padding:0;} #bg { Background: #000;p osition:absolute;left:0;top:0;filter: "Alpha (opacity=20)"; opacity:0.2;display:none;} #win {width:200px;height:200px;position:absolute;left:50%;top:50%;margin:-100px-100px 0;border:4px #F00 solid; Background: #FFF;d isplay:none;} &lt;/style&gt; &lt;/head&gt; &nbsp; &lt;body&gt; &lt;a href= "javascript:;" onclick= "Wintip ()" &gt; Popup &lt;/a&gt; &lt;div id= "BG" &gt;&lt;/div&gt; &lt;div id= "Win" &gt;&lt;a href= "javascript:;" onclick= "Wintip ()" &gt; Close &lt;/a&gt;&lt;/div &gt; &lt;/body&gt; &lt;script type= "Application/javascript" &gt; var $=function (id) {return document.getElementById (ID );} function Wintip () {var win=new winsize (); var tip=$ ("BG"); w+ "px"; h+ "px"; if ( "block") { "none"; $ ("WIn "). style.display=" None "; }else{ "Block", $ ("Win"). style.display= "Block";} function winsize ()//functions: Get dimension {var winwidth = 0; var winheight = 0; if (window.innerwidth) winwidth = window.innerwidth; E LSE if ((Document.body) &amp;&amp; (document.body.clientWidth)) winwidth = Document.body.clientWidth; if (window.innerheight) winheight = window.innerheight; else if ((document.body) &amp;&amp; (document.body.clientHeight)) winheight = Document.body.clientHeight; if (document.documentelement &nbsp;&amp;&amp; document.documentElement.clientHeight &amp;&amp; Document.documentElement.clientWidth) {winheight = document.documentElement.clientHeight; winwidth = Document.documentElement.clientWidth;} return{"W": Winwidth, "H": Winheight}} &lt;/script&gt; &lt;/html&gt;&lt;/td&gt; &nbsp;&lt;/tr&gt; &lt;/table&gt;
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.