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

用户登录弹出提示层?
我想要做论坛登录的那种效果,如果用户没有登录进入某个页面就弹出一个有用户名密码提示的小层,背景为灰不可操作,哪位大侠有代码共享下。。。。

我现在用的一个js不好用:
<body onload="showPopWin('modalContent.html', 400, 270, null);" > ----body的onload事件没用,如果是<button onclick="showPopWin('modalContent.html', 400, 270, null);">这样写还是可以的,但这方法似乎不好,大侠有经典代码共享下,谢谢~~~

------解决方案--------------------
使用jquery thickbox插件很方便的
------解决方案--------------------
可以试试这个弹出层效果
------解决方案--------------------
简单的:
HTML code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<head>
<script>
function $$(id){return document.getElementById(id)}
var c=null,d=null;
window.onload = function() {
  var sW=document.compatMode=="CSS1Compat"?document.documentElement.scrollWidth:document.body.scrollWidth;// alert(sW)
  var sH=document.compatMode=="CSS1Compat"?document.documentElement.scrollHeight:document.body.scrollHeight;// alert(sH)
  var W=Math.max(sW, document.documentElement.clientWidth);
  var H=Math.max(sH, document.documentElement.clientHeight);
  c=$$('c');  c.style.width =  W + "px";  c.style.height = H + "px";  c.style.display = "none";
  d=$$('d')
  with (d){
    style.width = W/3+"px";    style.height = H/3+"px";
    style.left = (W - d.offsetWidth)/2+"px";    style.top = (H - d.offsetHeight)/2+"px";
    style.display = "none";
  }
};

</script>
</head>
<BODY>
<div id='c' style="filter:alpha(opacity=80);Opacity:0.8; background-color:#aaaaaa; position:absolute; left:0px; top:0px;"> </div>
<!--弹出登陆窗口-->
<div id='d' style="border:1px solid #666666 ; padding:50px; position:absolute; background-color:#f5f5dc">
登录: <br>
<form method=post action='login.asp' name=frm>
用户名:<input type=text id=nickname name=nickname /><br>
密&nbsp;&nbsp;码:<input type=text id=pwd name=pwd /><br><br>
<input type=submit id=b name=b value=提交 />
<input value="关闭" type="button" onclick="javacript:d.style.display =c.style.display = 'none';" />
</form>
</div>

<input value='点击弹出窗口' type="button" onclick="javascript:d.style.display =c.style.display = '';" />

</BODY> </HTML>