Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-02-2007, 11:09 PM   PM User | #1
cheechm
Regular Coder

 
Join Date: Jan 2007
Posts: 123
Thanks: 20
Thanked 1 Time in 1 Post
cheechm is an unknown quantity at this point
Only Works in Firefox

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Protected Area</title>

<script type="text/javascript">
    var GB_ROOT_DIR = "http://layton.byethost7.com/greybox/";
</script>
<script type="text/javascript"> djConfig = { isDebug: false }; </script>
<script type="text/javascript" src="../dojo/dojo.js"></script>
<script type="text/javascript">
	dojo.require("dojo.widget.Dialog");
	dojo.require("dojo.widget.Button");
</script>
<script type="text/javascript" src="../greybox/AJS.js"></script>
<script type="text/javascript" src="../greybox/AJS_fx.js"></script>
<script type="text/javascript" src="../greybox/gb_scripts.js"></script>
<link href="../greybox/gb_styles.css" rel="stylesheet" type="text/css" />



</head>

<?
include("admin/protected/include/session.php");
?>


<?
/* User is not logged in */
if(!$session->logged_in){ ?>

<body onload="dlg0.show()">

<script type="text/javascript">
var dlg0;
function init(e) {
	dlg0 = dojo.widget.byId("dialog0");
	var btn = document.getElementById("hider0");
	dlg0.setCloseControl(btn);

}
dojo.addOnLoad(init);

</script>






<style type="text/css">
	body { font-family : sans-serif; }
	.dojoDialog {
		background : #ffffff;
		border : 1px solid #999;
		-moz-border-radius : 5px;
		padding : 4px;
<	margin-bottom : 0;
	}

	/* group multiple buttons in a row */
	.box {
		display: block;
		text-align: center;
	}
	.box .dojoButton {
		float: left;
		margin-right: 10px;
	}
	.dojoButton .dojoButtonContents {
		font-size: medium;
	}

</style>
<br>
<br>

<div dojoType="dialog" id="dialog0" bgColor="black" bgOpacity="0.5" toggle="fade" toggleDuration="250">
<table>
<tr><td>

<?
/**
 * User has already logged in, so display relavent links, including
 * a link to the admin center if the user is an administrator.
 */
if($session->logged_in){

   echo "<h1>Logged In</h1>";
echo "<script type=\"text/javascript\">";
echo "document.write('<a id=\"hider0\" href=\"#\">[X]</a>');";
echo "</script>"; 






}

else{
?>

<h1>Login</h1>
<?
/**
 * User not logged in, display the login form.
 * If user has already tried to login, but errors were
 * found, display the total number of errors.
 * If errors occurred, they will be displayed.
 */
if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="../admin/protected/process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="../admin/protected/forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a href="../admin/protected/register.php">Sign-Up!</a></td></tr>
</table>
</form>


<?
}
?>




</td></tr>
</table>


</div>

</body>


<?
}
/* User is logged in */
else{
?>
<body>
<script language="javascript"><!--
location.replace("admin/control.php")
//-->
</script>
</body>

<?
}
?>
</html>

Saved in a .php file.

When I try this in IE v 6 and 7 I get the following error:

Line 88
Char 1
Error dlg0 is null or not an object
Code 0

and

Line 97
Char 1
Error bad srcObj for srcFunc: onclick
Code 0
cheechm is offline   Reply With Quote
Old 05-03-2007, 02:09 PM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Maybe dojo is a Firefox widget?
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:00 AM.


Advertisement
Log in to turn off these ads.