[thelist] Javascript snafu

Duncan O'Neill dbaxo at ihug.co.nz
Sun Sep 3 06:39:52 CDT 2000


Hey all,

I'm trying to write what should be a simple Javascript code to 
populate a pull-down select list of favorites on a page,  
using cookies along with an 'add to favourites' function.

I've got the code working up to a point (i.e. the list appears 
as it should when I leave the (local) page then return), but 
I'm about ready to do myself GBH trying to add the expiry date 
statement to save the cookie to the hard drive so it will work 
after quitting the browser. This how I'm trying to add it;

     var the_date=new Date("September 10, 2000");
     var the_cookie_date=the_date.toGMTString();
     the cookie=the_cookie  + ";expires=" + the_cookie_date;
     document.cookie=the_cookie;

I'm calling the function from onLoad within the BODY tag. After I 
add the above lines, I get an error message which says "Object 
expected"  the BODY tag line. The error message disappers when I
comment out these lines.

It's probably difficult to do without seeing the whole code, but 
rather than inflict that on you, I was hoping someone may be able 
to suggest obvious errors I'm making, especially with 
the above Date object.

Any help appreciated,

cheers,

Duncan O'Neill
=====================================================================




More information about the thelist mailing list