我想要做论坛登录的那种效果,如果用户没有登录进入某个页面就弹出一个有用户名密码提示的小层,背景为灰不可操作,哪位大侠有代码共享下。我现在用的一个js不好用:
<body  onload="showPopWin('modalContent.html', 400, 270, null);" > ----body的onload事件没用,如果是<button onclick="showPopWin('modalContent.html', 400, 270, null);">这样写还是可以的,但这方法似乎不好,大侠有经典代码共享下,谢谢~~~

解决方案 »

  1.   

    使用jquery thickbox插件很方便的
      

  2.   

    简单的:<!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>
      

  3.   

    我要是想做个这个怎么做啊?javaweb项目里的:
    在该任务开始时间和结束时间内,执行人用户每次登陆系统能够自动弹出提示信,提示有待办的周期任务。当完成后和结束时间后不在提醒