【问题标题】:clicking in a link inside a div loads in new window单击 div 内的链接会在新窗口中加载
【发布时间】:2012-05-04 16:29:58
【问题描述】:

我正在尝试使我网站中的登录表单出现在页面中间,背景为灰色,所以我这样做了:

     <style type="text/css"> 
        #cover5{position:absolute;top:0px;left:0px;overflow:hidden;display:none;width:100%;height:100%;background-color:gray;text-align:center}
    #warning{top: 150px;margin:auto;position:relative;width:600px;height:fit-content;background-color:white;color:black;padding:10px; zIndex:20; border: 5px solid #003366;}
        </style
        <div id="cover5" onclick="javascript:cover5();">
                <div id="warning" onclick="javascript:cover5();">
                    <?php include 'SignIn.php'; ?>
                </div>
            </div>
<script>
 function cover5()
            {

                var cover=document.getElementById('cover5');

                if(vis)
                {
                    vis=0;
                    cover.style.display='block';
                }
                else
                {
                    vis=1;
                    cover.style.display='none';
                }
            }
</script>

这是SignIn.php的代码

<form id='login' action='SignIn.php' method='post' accept-charset='UTF-8' onsubmit="return valid()">
<fieldset >
<legend>SignIn</legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<label for='username' >Email:</label>
<input type='text' name='email' id='username'  maxlength="50" /> <br />
<label for='password' >Password:</label>
<input type='password' name='password' id='password' maxlength="50" /> <br />
<input type='submit' name='Submit' value='Login' /> <br />
<a href='resetPassword1.php'> Forgot/Reset Password? Click Here</a>
</fieldset>
</form>

问题是当使用点击忘记/重置密码?或输入错误的数据一切都在新窗口中打开,我使用 iframe 而不是 div 但是当使用登录成功时,主页在同一个 iframe 中打开,所以有人知道如何解决这个问题吗? 抱歉这个问题太长了:)

【问题讨论】:

    标签: php javascript html login-script


    【解决方案1】:

    您需要将此添加到您的链接中:

    target='_self'
    

    所以它看起来像这样:

    <a href='resetPassword1.php' target='_self'> Forgot/Reset Password? Click Here</a>
    

    还有其他你可以玩的,比如在新窗口中打开:

    target='_blank'
    

    希望对你有帮助

    【讨论】:

      【解决方案2】:

      在链接内尝试设置target="_self"so

      <a href="resetPassword1.php" target="_self">Forgot/Reset Password? Click Here</a>
      

      如果这不起作用,请在另一个浏览器中尝试。有时浏览器的默认设置可能会搞砸。另一个可能的问题可能是您网站某处的 Javascript 将您的链接发送到新窗口。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-11-19
        • 2013-09-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多