Code
<! 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> jquery pop-up layer instance </title>
<SCRIPT type = "text/JavaScript" src = "http://www.jqueryajax.com/wp-content/uploads/2009/03/jquery-132min1.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
$ (Function ()
{
$ ("# Btnshow"). Click (function ()
{
VaR STR = "I Am a pop-up dialog box ";
$ (". Form" example .html (STR );
$ ("# Bgdiv" ).css ({display: "Block", height: $ (document). Height ()});
VaR yscrollappsdocument.doc umentelement. scrolltop;
$ ("# Dialogdiv" ).css ("TOP", "100px ");
$ ("# Dialogdiv" ).css ("display", "Block ");
Document.doc umentelement. scrolltop = 0;
});
$ ("# Btnclose"). Click (function ()
{
$ ("# Bgdiv" ).css ("display", "NONE ");
$ ("# Dialogdiv" ).css ("display", "NONE ");
});
});
</SCRIPT>
<Style type = "text/CSS">
Body, H2 {margin: 0; padding: 0 ;}
# Bgdiv {background-color: # e3e3e3; position: absolute; Z-index: 99; left: 0; top: 0; display: none; width: 100%; Height: 1000px; opacity: 0.5; filter: alpha (opacity = 50);-moz-opacity: 0.5 ;}
# Dialogdiv {position: absolute; width: 400px; left: 50%; top: 50%; margin-left:-200px; Height: auto; Z-index: 100; Background-color: # FFF; Border: 1px #8fa4f5 solid; padding: 1px ;}
# Dialogdiv H2 {Height: 25px; font-size: 14px; Background-color: #8fa4f5; position: relative; padding-left: 10px; line-Height: 25px ;}
# Dialogdiv H2 A {position: absolute; Right: 5px; font-size: 12px; color: #000000}
# Dialogdiv. FORM {padding: 10px ;}
</Style>
</Head>
<Body>
<Div id = "bgdiv"> </div>
<Div id = "dialogdiv" style = "display: none">
<H2> <a href = "#" id = "btnclose"> close </a> </H2>
<Div class = "form">
The "I am" dialog box is displayed !!
</Div>
</Div>
<P> & nbsp; </P>
<P align = "center">
<Input value = "pop-up" class = "but" type = "button" id = "btnshow"/>
</P>
</Body>
</Html>