[JS]Popup sluit? Maar moet niet.
Sinds ik het vorige probleem heb opgelost met mijn JS popup, ben ik gestuit op een nieuwe probleem.
Als ik nu op het plaatje 'login' klik krijg ik een popup waar ik de gegevens moet invullen; Dat werkt, maar als ik dan in de popup op login klik sluit de popup en moet ik opnieuw op het plaatje 'login' klikken om de popup weer te openen en het resultaat te zien.
Iemand enig idee waarom de popup sluit;
Code:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function login() {
if(document.getElementById('login_darker').style.display == "block") {
document.getElementById('login_darker').style.display = "none";
document.getElementById('login').style.display = "none";
return
} else {
document.getElementById('login_darker').style.display = "block";
document.getElementById('login').style.display = "block";
return
}
}
function register() {
if(document.getElementById('register_darker').style.display == "block") {
document.getElementById('register_darker').style.display = "none";
document.getElementById('register').style.display = "none";
return
} else {
document.getElementById('register_darker').style.display = "block";
document.getElementById('register').style.display = "block";
return
}
}
if(document.getElementById('login_darker').style.display == "block") {
document.getElementById('login_darker').style.display = "none";
document.getElementById('login').style.display = "none";
return
} else {
document.getElementById('login_darker').style.display = "block";
document.getElementById('login').style.display = "block";
return
}
}
function register() {
if(document.getElementById('register_darker').style.display == "block") {
document.getElementById('register_darker').style.display = "none";
document.getElementById('register').style.display = "none";
return
} else {
document.getElementById('register_darker').style.display = "block";
document.getElementById('register').style.display = "block";
return
}
}
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td colspan="2">Login<hr /></td>
</tr>
<tr> <!-- Click on image to open popup:login-->
<td><a href="javascript:login()"><img src="_images/buttons/login.png" border="0" /></a>
<div class="darker" id="login_darker" />
<div class="popup" id="login">
<?php include('_includes/login/login.php'); ?>
<div align="right"><a href="javascript:login()"><img src="_images/close.png" border="0" /></a></div>
</div>
</div>
</td> <!-- Click on image to open popup:register-->
<td><a href="javascript:register()"><img src="_images/buttons/register.png" border="0" /></a>
<div class="darker" id="register_darker">
<div class="popup" id="register">
<?php include('_includes/register/join.php'); ?>
<div align="right"><a href="javascript:register()"><img src="_images/close.png" border="0" /></a></div>
</div>
</div>
</td>
</tr>
</table>
<tr>
<td colspan="2">Login<hr /></td>
</tr>
<tr> <!-- Click on image to open popup:login-->
<td><a href="javascript:login()"><img src="_images/buttons/login.png" border="0" /></a>
<div class="darker" id="login_darker" />
<div class="popup" id="login">
<?php include('_includes/login/login.php'); ?>
<div align="right"><a href="javascript:login()"><img src="_images/close.png" border="0" /></a></div>
</div>
</div>
</td> <!-- Click on image to open popup:register-->
<td><a href="javascript:register()"><img src="_images/buttons/register.png" border="0" /></a>
<div class="darker" id="register_darker">
<div class="popup" id="register">
<?php include('_includes/register/join.php'); ?>
<div align="right"><a href="javascript:register()"><img src="_images/close.png" border="0" /></a></div>
</div>
</div>
</td>
</tr>
</table>
Andere code;
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<form method="post" name="login_form" action="#" />
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td colspan="2">Login
<hr /></td>
</tr>
<tr>
<td>Username:</td>
<td><input name="username" type="text" value="<?php echo $_POST['username']; ?>" class="login-text" maxlength="35" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="password" type="password" value="<?php echo $_POST['password']; ?>" class="login-text" maxlength="18" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="login" class="login" value="" /></td>
</tr>
</table>
</form>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(isset($_POST['login']))
{
$name = $_POST['username'];
$password = md5($_POST['password']);
$qLog = mysql_query("SELECT rank FROM users WHERE username = '" . mysql_real_escape_string( $name ) . "' AND password = '" . $password . "' LIMIT 1");
$qLog_count = mysql_num_rows($qLog);
if($qLog_count != 0)
{
$aQueryInfo = mysql_fetch_assoc( $qLog );
$_SESSION['login-rank'] = $aQueryInfo["rank"];
$_SESSION['login-name'] = $name;
///DEZE TEXT MOET IN DIE POPUP DIE BOVENAAN STAAT AANGEGEVEN!!!
echo '<p><strong>Succesful logged in.</strong>';
echo '<br />';
echo 'Please wait...</p>';
echo '<meta http-equiv="refresh" content="3;url=http://localhost/cm-site" />';
}
elseif($qLog_count == 0)
{
$_SESSION['login-rank'] = 0;
///DEZE TEXT MOET IN DIE POPUP DIE BOVENAAN STAAT AANGEGEVEN!!!
echo '<p><strong>Incorrect login details.</strong>';
echo '<br />';
echo 'Lost password? click <a href="lost_password.php">here</a></p>';
echo '<meta http-equiv="refresh" content="5;url=http://localhost/cm-site" />';
}
}
}
?>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td colspan="2">Login
<hr /></td>
</tr>
<tr>
<td>Username:</td>
<td><input name="username" type="text" value="<?php echo $_POST['username']; ?>" class="login-text" maxlength="35" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="password" type="password" value="<?php echo $_POST['password']; ?>" class="login-text" maxlength="18" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="login" class="login" value="" /></td>
</tr>
</table>
</form>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(isset($_POST['login']))
{
$name = $_POST['username'];
$password = md5($_POST['password']);
$qLog = mysql_query("SELECT rank FROM users WHERE username = '" . mysql_real_escape_string( $name ) . "' AND password = '" . $password . "' LIMIT 1");
$qLog_count = mysql_num_rows($qLog);
if($qLog_count != 0)
{
$aQueryInfo = mysql_fetch_assoc( $qLog );
$_SESSION['login-rank'] = $aQueryInfo["rank"];
$_SESSION['login-name'] = $name;
///DEZE TEXT MOET IN DIE POPUP DIE BOVENAAN STAAT AANGEGEVEN!!!
echo '<p><strong>Succesful logged in.</strong>';
echo '<br />';
echo 'Please wait...</p>';
echo '<meta http-equiv="refresh" content="3;url=http://localhost/cm-site" />';
}
elseif($qLog_count == 0)
{
$_SESSION['login-rank'] = 0;
///DEZE TEXT MOET IN DIE POPUP DIE BOVENAAN STAAT AANGEGEVEN!!!
echo '<p><strong>Incorrect login details.</strong>';
echo '<br />';
echo 'Lost password? click <a href="lost_password.php">here</a></p>';
echo '<meta http-equiv="refresh" content="5;url=http://localhost/cm-site" />';
}
}
}
?>
Alvast bedankt!
Gewijzigd op 01/01/1970 01:00:00 door [email protected]
Iemand?