日期:2014-05-17  浏览次数:20628 次

{散点分}带问个问题,需要这种层居中效果!进来看吧。
http://my.blog.sina.com.cn/member/signup/reg_step1.php
点下《查看登陆名是否可用》然后会有个层居中在浏览器中间!
具体实现要求就是不管浏览是状态是最大化还是拖动成600*400或者800*600,这个层始终需要显示在这个浏览器的正中间。
我也在baidu跟google查过,没查到资料!
等人回答,一经测试通过马上全分相送!


------解决方案--------------------
先在body里定义text-align:center然后在在层上定义margin: 0 auto;
------解决方案--------------------
看一下这里有没有
http://community.csdn.net/Expert/topic/4749/4749992.xml?
------解决方案--------------------
<html>

<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 网页特效代码|JsCode.CN|---始终在最前面的弹出窗口对话框 </title>
</head>

<body>
<SCRIPT>
function fnRandom(iModifier){
return parseInt(Math.random()*iModifier);
}
function fnSetValues(){
var iHeight=oForm.oHeight.options[
oForm.oHeight.selectedIndex].text;
if(iHeight.indexOf( "Random ")> -1){
iHeight=fnRandom(document.body.clientHeight);
}
var sFeatures= "dialogHeight: " + iHeight + "px; ";
return sFeatures;
}
function fnOpen(){
var sFeatures=fnSetValues();
window.showModalDialog( "showModalDialog_target.htm ", " ",
sFeatures)
}
</SCRIPT>
<FORM NAME=oForm>
窗口高度: <SELECT NAME= "oHeight ">
<OPTION> -- 随机 --
<OPTION> 150
<OPTION> 200
<OPTION> 250
<OPTION> 300
</SELECT>
打开窗口:
<INPUT TYPE= "button " VALUE= "打开窗口 "
onclick= "fnOpen() ">
</FORM>
</body>

</html>
------解决方案--------------------
<!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=gb2312 " />
<title> 无标题文档 </title>
<script type= "text/javascript ">
function sh(){
document.getElementById( "aa ").style.display = " ";
document.getElementById( "aa ").style.top = ((document.documentElement.clientHeight-80)/2) + "px ";
document.getElementById( "aa ").style.left = ((document.documentElement.clientWidth-200)/2) + "px ";
}
</script>
</head>

<body>
<a href= "# " onclick= "sh(); "> fdsafdsa </a>
<div id= "aa " style= "width:200px; height:80px; background-color:#009966; position:absolute; z-index:1; display:none "> </div>
</body>
</html>
------解决方案--------------------
接分了
------解决方案--------------------
第一,它的查询返回页面是(以我的用户名举例):
http://my.blog.sina.com.cn/member/signup/check_members.php?username=shortway

第二,你可以看看:http://my.blog.sina.com.cn/js/dialog.js

关键代码应该是下面的吧(我没细看):

this.showWindow = function(_sUrl, _iWidth, _iHeight, _sMode, _sTitle){
var oWindow;
var sLeft = (screen.width) ? (screen.width - _iWidth)/2 : 0;
var iTop = -80 + (screen.height - _iHeight)/2;
iTop = iTop > 0 ? iTop : (screen.height - _iHeight)/2;