You use null to see if it has a value.  obviously its value is null, so it
will display "null"

Your code

if(getCookie('yourname') != " null ")

{

        document.write(getCookie('yourname'));

}

will look for " null " where its value may be "null", so it wont work.

try something like


if (typeof getCookie("yourname") != "undefined")
        {
        if(getCookie("yourname").replace(/[ ]/g,"") != "null" ||
getCookie("yourname").replace(/[ ]/g,"") != "")
                {document.write(getCookie('yourname'));}
        else
                {document.write("Cookie was there but its blank or its value is 
null");}
        }
else
        {document.write("Cookie was not there");}


Steve





-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Balaji
Sent: Tuesday, June 24, 2003 3:04 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: javascript : Trap null in cookie



Tried without double quote as well. Still displays Welcome null.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Taco Fleur
Sent: Tuesday, June 24, 2003 2:53 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: javascript : Trap null in cookie



Without the double quotes

if(getCookie('yourname') != null)

{

        document.write(getCookie('yourname'));

}

Taco

----------------------------------------------------------------------------
This email, together with any attachments, is intended for the named
recipient(s) only and may contain privileged and confidential information.
If
received in error, please inform the sender as quickly as possible and
delete
this email and any copies from your computer system network.

If not an intended recipient of this email, you must not copy, distribute or
rely upon it and any form of disclosure, modification, distribution and/or
publication of this email is prohibited.

Unless stated otherwise, this email represents only the views of the sender
and
not the views of the Queensland Government.
----------------------------------------------------------------------------

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to