W
Warwick Boardman
I found an error due to my incorrect use of the document.write
facility. I'd love to know why it was wrong to use document.write
where I did.
I had a problem using the login script obtainable via
http://www.laughland.biz/javascript.php .
I tried using diagnostic prints using document.write. This didn't
seem to help me so I was pleased to find that there was a new
Javascript debugger available so I downloaded Netscape 7.1 with
Venkman so that I could try to find out what was going on.
I made more than one version of the script and have somehow got one
set of .html/.js files to work as expected. That allowed me to
determine that the use of document.write - as shown commented out in
the script portions below - was a problem.
In Venkman the variable "successpage" was defined up to the point of
the document.write line so that when trying to use it after a
document.write statement it was undefined - hence an error. Yet the
document.write itself did output what was required.
I don't know enough about Javascript to know why it was wrong to use
the document.write command within the function definition code. I'd
love an explanation or a useful specific reference, please.
Relevant parts of the script with the document.write now shown
commented out:
//----------------------------------------------------------------
// Usernames, Passwords & User Pages - These require configuration.
//----------------------------------------------------------------
var successpage = "sysdoc.html"; // The page users go to after login,
if they have no personal page.
var loginpage = "sysdoc_login.html"; //Change this to the page the
login panel is on.
var users = new Array();
..
..
..
//----------------------------------------------------------------
// Login Functions
//----------------------------------------------------------------
function login(username,password){
var member = null;
var loggedin = 0;
facility. I'd love to know why it was wrong to use document.write
where I did.
I had a problem using the login script obtainable via
http://www.laughland.biz/javascript.php .
I tried using diagnostic prints using document.write. This didn't
seem to help me so I was pleased to find that there was a new
Javascript debugger available so I downloaded Netscape 7.1 with
Venkman so that I could try to find out what was going on.
I made more than one version of the script and have somehow got one
set of .html/.js files to work as expected. That allowed me to
determine that the use of document.write - as shown commented out in
the script portions below - was a problem.
In Venkman the variable "successpage" was defined up to the point of
the document.write line so that when trying to use it after a
document.write statement it was undefined - hence an error. Yet the
document.write itself did output what was required.
I don't know enough about Javascript to know why it was wrong to use
the document.write command within the function definition code. I'd
love an explanation or a useful specific reference, please.
Relevant parts of the script with the document.write now shown
commented out:
//----------------------------------------------------------------
// Usernames, Passwords & User Pages - These require configuration.
//----------------------------------------------------------------
var successpage = "sysdoc.html"; // The page users go to after login,
if they have no personal page.
var loginpage = "sysdoc_login.html"; //Change this to the page the
login panel is on.
var users = new Array();
..
..
..
//----------------------------------------------------------------
// Login Functions
//----------------------------------------------------------------
function login(username,password){
var member = null;
var loggedin = 0;