Save cookies with javascript how to specify domain?
<p>I'm using this code to save cookies:</p>

<pre><code>function saveCookie(name,value) {
        var date = new Date();
        date.setTime(date.getTime()+(60*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
        document.cookie = name+"="+value+expires+"; path=/";
        }
</code></pre>

<p>My problem is that it saves the cookie with domain "example.com" and I want to write them to ".example.com" so I can also read them from subdomains. This is easy to do with PHP but I don't know how to do it with javascript. How can I add a dot before the domain when I save the cookie?</p>
