Loading ...
Sorry, an error occurred while loading the content.
 

Re: Cookies, Form input

Expand Messages
  • Joe
    Hay, Thanks for the info, It s just that it doesn y explan where the vars are comming from or how they are set. Heres the sample. how do you the domain, or the
    Message 1 of 4 , Jul 11, 2005
      Hay, Thanks for the info, It's just that it doesn'y explan where the
      vars are comming from or how they are set.

      Heres the sample. how do you the domain, or the expires date, and so
      on. they don't tell me that.


      function setCookie(name, value, expires, path, domain, secure) {
      var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") + #How
      do you set this
      ((path) ? "; path=" + path : "") + #How do you set this
      ((domain) ? "; domain=" + domain : "") + #How do you set this
      ((secure) ? "; secure" : ""); #Never needed it
      document.cookie = curCookie;

      Thanks

      Joe
      Thats why I was hoping it could get some one to send me a sample.



      --- In javascript_official@yahoogroups.com, "Joe" <bigjoe11a@y...> wrote:
      > I been trying to teach my self Javascript. well its worst then perl.
      >
      > any way.
      >
      > Not in my web site. just in some perl scripts that I have. It reads 3
      > cookies.
      > name,email and password.
      > These are required for some parts of my scripts. Just not for My web
      > site. I want to change that. Sence I can't load a perl script from a
      > html page. I have no choose but to use Javascript.
      >
      > Can any one send me some samples of setting, getting, and displaying
      > cookies.
      >
      > Please try and make them simple. as possiable.
      >
      > Ok, heres my story. on my index.html page. I want to set up a
      > Javascript that will get 3 cookies, if they exist, it then creates the
      > use with the value in 'name'. if no cookies are fount. it calls a
      > function to asks for a name,email and a pssword. then it sets the
      > cookies onclick, and greets the user with there name.
      >
      > Thanks
      >
      > Joe
    • Joe
      Hi! Tim, again thanks, its just I can t get any thing to work, I can get a session cookie to work, its just when I want to set the domain and path, well it
      Message 2 of 4 , Jul 11, 2005
        Hi! Tim, again thanks, its just I can't get any thing to work, I can
        get a session cookie to work, its just when I want to set the domain
        and path, well it doesn't work.

        Let me give you an idea on what I'm trying to do.

        On my main Page (index.htm) I have a a button.

        <FORM>
        <input type=button value="Registering" onclick="SetCookie">
        </FORM>

        as you know this calls a function (SetCookie), Heres me code

        <SCRIPT LANGUAGE="JavaScript">
        function SetCookie()
        {
        // get the information
        //
        var the_name = prompt("What's your name?","");
        var the_date = new Date("December 31, 2023");
        var the_cookie_date = the_date.toGMTString();
        var the_path = the_cookie + "path=/;";
        var the_domain = the_cookie + "domain=www.joes-computer.com;";
        // build and save the cookie
        //
        var the_cookie = "my_cookie=" + escape(the_name);
        var the_cookie = the_cookie + ";expires=" + the_cookie_date +
        ";domain=" + the_domain;
        document.cookie = the_cookie;
        <!--
        Then I need it to repeat 2 more times for these vars
        var the_email = prompt("E-Mail Address :";"");
        var the_password = prompt("Password :";"");
        --!>
        alart("Registering Completed");


        }
        </SCRIPT>

        This should give you an idea on what I'm tring to do, and where to
        send me.
      Your message has been successfully submitted and would be delivered to recipients shortly.