日期:2014-05-16  浏览次数:20363 次

如何在一个页面上弹出或浮出一个对话框并在上面可以添加文本框及按钮
我不知道如何准确的描述。就是说在一个页面 通过一个按钮一点 之后弹出或者说浮出一个框来(就像大的对话框一样),之后在上面可以添加文本框,按钮啊, 图片啊什么的。 可以让人在这输入信息。。。并且这个框是浮在页面上的 如果不特意关闭或者进行其他操作的话这个框是一直置顶在那个网页上的。在很多网站都有这个东西。 希望大家指点,那个到底是什么东西,如何做出来。请大家给个例子。

------解决方案--------------------
楼主 可以搜下 js dialog

推荐个插件。
http://www.planeart.cn/demo/artDialog/_doc/new.html
------解决方案--------------------
如果自己做的话,做一个弹出层就可以了!

如果用插件的话,Google一下应该很多.
------解决方案--------------------
测试环境火狐::我不喜欢IE 你要是不满意 就自己改一下吧
<!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> 用一个弹出层覆盖整个HTML页面 </title>
<script type= "text/javascript ">
function openDiv(){
var upDiv = document.getElementById( "upDiv ");
upDiv.style.display = "block ";
}
</script>
<style type= "text/css ">
html,body{
width:100%;
height:100%;

}
#upDiv{
width:100%;
height:100%;
display:none;
position:absolute;
top:0;
left:0;
z-index:9999;

}
.form{
position:absolute;
left:50%;
top:50%;
margin-left:-110px;
margin-top:-50px;
width:220px;
height:100px;
border:1px solid red;
background:#FFF;
z-index:1000;
}
</style>
</head>
<body>
<input type= "button " value= " 点 击 弹 出 层 " onclick= "openDiv(); " />
<div id= "upDiv ">
<div class= "form ">
<form action= " " method= "get ">
用户名: <input type= "text " name= " " /> <br />
密 码: <input type= "password " name= " " /> <br />
<input type= "button " value= " 确 定 " />
</form>
</div>
</div>
用户名: <input type= "text " /> <br />
密 码 : <input type= "password " />
</body>
</html>