Results 1 to 3 of 3

Thread: Cookie 'doesn't support property or method'

  1. #1
    Member
    Join Date
    Sep 2001
    Location
    Rhode Island
    Posts
    523

    Cookie 'doesn't support property or method'

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    
    <head>
    <title>Cookies</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/javascript">
    <!--
    function setCookie(name, value, expires, path, domain, secure) {
    	var curCookie = name + "=" + escape(value) +
    	((expires) ? "; expires=" + expires.toGMTString() : "") +
    	((path) ? "; path=" + path : "") +
    	((domain) ? "; domain=" + domain : "") +
    	((secure) ? "; secure" : "");
    	document.cookie = curCookie;
    }
    
    // -->
    </script>
    </head>
    
    <body>
    <input type="button" value="Set Cookie" onClick="setCookie('cookie1', 'I%20like%20cookies!', 'December 15, 2001', '/', 'http://members.home.net/gshelpboy/');">
    </body>
    </html>
    Any idea what's wrong??

  2. #2
    Moderator Owl's Avatar
    Join Date
    Jan 2001
    Location
    Bangkok, Thailand
    Posts
    988
    Hi GSHelpBoy,

    The expires argument expects a date object and not a date string.
    Also you dont need to escape the string you pass to the value argument
    because it is escaped inside the function. Try this:
    Code:
    <input type="button" value="Set Cookie" onClick="setCookie('cookie1', 'I like cookies!', new Date('December 15, 2001'), '/', 'http://members.home.net/gshelpboy/');">
    ( •) (• )
    >>V

  3. #3
    Moderator
    United Nations Vincent Puglia's Avatar
    Join Date
    Jan 2000
    Location
    where the World once stood
    Posts
    4,961
    Hi GSHelpBoy,

    var today = new Date();

    .....today.toGMTString() .....

    (you need something toString

    Vinny
    The Blades of Grass cut me still
    grassBlade

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. JavaScript Object doesn't support this property or method
    By Kolrad in forum Client-side forum
    Replies: 4
    Last Post: 27th May 2010, 03:34
  2. object doesn't support this method or property error??
    By AMC in forum Client-side forum
    Replies: 3
    Last Post: 23rd October 2004, 16:51
  3. Object doesn't support this property or method
    By jhkrs in forum Client-side forum
    Replies: 4
    Last Post: 30th July 2003, 23:26
  4. Error "Object doesen't support this property or method"
    By sheetal_dasarwar in forum Client-side forum
    Replies: 2
    Last Post: 23rd February 2002, 04:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •