好吧,我一直在尝试修复此代码,并将其搜索超过6小时,这就是杀了我
我要做的是尝试隐藏登录表和与之关联的背景图像(#lg #ck),并在点击登录表的位置顶部放置一个按钮,它将显示登录表
<?php
require_once( 'inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'db.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
check_logged();
if(!isMember()) {
echo '<body style="margin:0;">
<div style="margin:0 auto" align=center>
<form onsubmit="validateLoginForm(this); return false;" method="post" action="member.php" id="login_box_form">
<table id="ck">
<tbody>
<tr>
<td width="180">Name</td>
<td width="150">Code</td>
<td width="50"> </td>
</tr>
<tr>
<td width="180"><input style="width:180px;" name="ID" type="text"></td>
<td width="180"><input style="width:180px;"name="Password" type="password"></td>
<td><input name="LogIn" type="submit" tabindex="3" value="Login"></td>
</tr>
<tr>
<td width="180"><input type="checkbox" name="rememberMe"> Keep me logged in</td>
<td width="180"><a href="forgot.php">Forgot password?</a></td>
<td width="50"> </td>
</tr>
</tbody>
</table>
</form>
</div>
<div style="width:100%;height:20px;clear:both;"></div>
<div style="width:100%;height:600px;padding-left:40px;padding-right:40px;padding-top:20px;">';
}
else {
header("Location: index.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Nox's Ark</title>
</head>
<body id="lg"> <p class="bt"></p>
</div>
</p>
<style media="screen" type="text/css">
html {
background: url(../img/bil.jpg)no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
overflow:hidden;
}
#ck {
width:450px;
border: 5px;
align:center;
cellpadding= 0px;
cellspacing= 1px;
padding-left:1100px;
padding-top:500px;
}
#lg {
background-image:url(../img/nbt.png);
background-repeat:no-repeat;
background-position: 1220px 380px;
}
.bt {
</style>
</body>
</html>
<?php
?>
这是有人建议的代码,但我不知道在哪里放置它。
<div id="ONE"><input type="button" value="Login" onClick="hideID('ONE');showID('TWO');" /></div>
<div id="TWO" style="display:none"><table cellspacing="0" cellpadding="0" align="center"><tr><td colspan="2"><h1>Login</h1></td></tr><tr><td>password:</td><td><input type="text" /></td></tr><tr><td>username:</td><td><input type="text" /></td></tr><tr><td colspan="2"><input type="submit" value="login" /></td></tr></table></div>
<script>
function hideID(objID){var element=(ie)?document.all(objID):document.getElementById(objID);element.style.display="none"}function showID(objID){var element=(ie)?document.all(objID):document.getElementById(objID);element.style.display="block"};
</script>
所以我把
`<?php
require_once( 'inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'db.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
check_logged();
if(!isMember()) {
echo '<body style="margin:0;">
<div style="margin:0 auto" align=center>
<form onsubmit="validateLoginForm(this); return false;" method="post" action="member.php" id="login_box_form">
<table id="ck">
<tbody>
<tr>
<td width="180">Name</td>
<td width="150">Code</td>
<td width="50"> </td>
</tr>
<tr>
<td width="180"><input style="width:180px;" name="ID" type="text"></td>
<td width="180"><input style="width:180px;"name="Password" type="password"></td>
<td><input name="LogIn" type="submit" tabindex="3" value="Login"></td>
</tr>
<tr>
<td width="180"><input type="checkbox" name="rememberMe"> Keep me logged in</td>
<td width="180"><a href="forgot.php">Forgot password?</a></td>
<td width="50"> </td>
</tr>
</tbody>
</table>
</form>
</div>
<div style="width:100%;height:20px;clear:both;"></div>
<div style="width:100%;height:600px;padding-left:40px;padding-right:40px;padding-top:20px;">';
}
else {
header("Location: index.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Nox's Ark</title><div id="ONE"><input type="button" value="Login" onClick="hideID('ONE');showID('TWO');" /></div>
<div id="TWO" style="display:none"><table cellspacing="0" cellpadding="0" align="center"><tr><td colspan="2"><h1>Login</h1></td></tr><tr><td>password:</td><td><input type="text" /></td></tr><tr><td>username:</td><td><input type="text" /></td></tr><tr><td colspan="2"><input type="submit" value="login" /></td></tr></table></div><script>function hideID(objID) {
var element = (ie) ? document.all(objID) : document.getElementById(objID);
element.style.display = "none";
}
function showID(objID) {
var element = (ie) ? document.all(objID) : document.getElementById(objID);
element.style.display = "block";
}</script>
</head>
<body id="lg"> <p class="bt"></p>
</div>
</p>
<style media="screen" type="text/css">
html {
background: url(../img/bil.jpg)no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
overflow:hidden;
}
#ck {
width:450px;
border: 5px;
align:center;
cellpadding= 0px;
cellspacing= 1px;
padding-left:1100px;
padding-top:500px;
}
#lg {
background-image:url(../img/nbt.png);
background-repeat:no-repeat;
background-position: 1220px 380px;
}
.bt {
</style>
</body>
</html>
<?php
?>`
这只显示左侧的登录按钮,右侧是上一个登录表(我试图隐藏)。左侧的登录按钮不会执行任何单击的操作。 我真的 感谢你,如果你们可以帮我这个,我甚至不认为我可以通过查看教程来做到这一点..保存我; _;
答案 0 :(得分:0)
我会做的是以下内容:
<div id="ONE"><input type="button" value="Login" onClick="hideID('ONE');showID('TWO');" /></div>
<div id="TWO" style="display:none"><table cellspacing="0" cellpadding="0" align="center"><tr><td colspan="2"><h1>Login</h1></td></tr><tr><td>password:</td><td><input type="text" /></td></tr><tr><td>username:</td><td><input type="text" /></td></tr><tr><td colspan="2"><input type="submit" value="login" /></td></tr></table></div>
使用JavaScript:
function hideID(objID) {
var element = (ie) ? document.all(objID) : document.getElementById(objID);
element.style.display = "none";
}
function showID(objID) {
var element = (ie) ? document.all(objID) : document.getElementById(objID);
element.style.display = "block";
}
希望它有所帮助!