SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Set Username in Cookie

    Hi All

    Im really not a javascript developer (far more ASP.NET) but I need to set the username of a user in a cookie using javascript

    So just before the form is submitted I use

    document.cookie="Username=" + document.form.ID.toString();
    where ID is the name of the text box where the Username is input

    All this returns is [object]

    Can anyone help

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2008
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    add ID attribute to input control like below:
    <input type="text" id="login" ...>

    the get its value using javascript code:
    document.getElementById("login").value

  3. #3
    SitePoint Member
    Join Date
    Mar 2008
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This article on cookies may be useful to you
    http://www.astral-consultancy.co.uk/...doco.cgi?11180
    Hope it helps


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
  •