2012-05-04 108 views
0

我试图让我的网站的登录表单上出现的与灰色背景的页面的中间,所以我已经做了这样的:点击在新窗口中一个div载荷内的链接

 <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,所以任何人都知道如何解决这个问题? 对不起,长的问题:)

回答

0

内部链接的尝试设置target="_self"所以

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

如果不行尝试在其他浏览器。有时浏览器会有可能会弄糟的默认设置。另一个可能的问题可能是Javascript在你的站点发送你的链接到新的窗口。

0

你需要把它添加到您的链接:

target='_self' 

所以它看起来像这样:

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

还有其他你可以有太多发挥,希望在新窗口中打开:

target='_blank' 

希望这有助于

相关问题