浮动窗口的实现

<!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>loading demo</title>
<script type="text/javascript">
function show(){
var loadbox =document.getElementById("loadlayer");
var overlayer = document.getElementById("overlayer");
loadbox.style.display = "block" ;
overlayer.style.display = "block" ;
}

function hide(){
var loadbox =document.getElementById("loadlayer");
var overlayer = document.getElementById("overlayer");
loadbox.style.display = "none" ;
overlayer.style.display = "none" ;
}
</script>

<style type="text/css">
#overlayer{
position: absolute;
top: 25%;
left: 25%;
z-index: 90;
width: 50%;
height: 50%;
background-color: #000;
filter:alpha(opacity=60);
-moz-opacity: 0.5;
opacity: 0.5;
display:none;
}

#loadbox{
position: absolute;
top: 45%;
left: 0;
width: 100%;
z-index: 100;
text-align: center;
}

#loadlayer{
display:none;
}

</style>
</head>
<body>
<div id="overlayer"></div>
<div id="loadbox" >
  <div id="loadlayer">
      <input type="text" value="" />
      <input type="password" value=""/>
      <input type="submit" value="Login">
    </div>
</div>
  <div id="containlayer">
     <input type="button" value="Login" onclick="show()" />
        <input type="button" value="Cancel" onclick="hide()"/>
        <br />
        <br />
        <p>
   dddddddddddddddddddddddddddddddddddddddddddddddd
   dddddddddddddddddddddddddddddddddddddddddddddddd
   dddddddddddddddddddddddddddddddddddddddddddddddd
   dddddddddddddddddddddddddddddddddddddddddddddddd
   dddddddddddddddddddddddddddddddddddddddddddddddd
   dddddddddddddddddddddddddddddddddddddddddddddddd
   dddddddddddddddddddddddddddddddddddddddddddddddd
   dddddddddddddddddddddddddddddddddddddddddddddddd
     </p>
  </div>
</body>
</html>

 

你可能感兴趣的:(JavaScript,html,XHTML,css)