Extending the answers already given (comments and custom JS method)... i wanted to place this in a working example... So here goes...
First of, using JSON allows you to easily convert a object to and from JSON without having to use your own methods.. It is the most common way and a well known standard these days.. So a majority of languages have support for JSON..
Extending the example provided by subas chandran...
var object={name : username.value, email : email.value, gender : gender.value};
var stringObj=JSON.stringify(object);
as seen here http://jsfiddle.net/LLujbb2h/ makes its easy to use, and your not restricted if you want to deal with strings / arrays and objects.. You simply hand it the main object and it does all the work for you... So why re-invent the wheel??
Using the non JSON method as show here http://jsfiddle.net/1bf4dg8o/ has a lot of problems like dealing with the object once you read it back from the cookie.. Its just a string... if say for example you put :: in your name/email/gender.. This would break the custom syntax... I would avoid this method at all costs!
Simply, test the first fiddle i have created and you'll see its alot easier to deal with...
Also use the inspector on your browser to view the cookie, as this will help with debugging..
EDIT - Showing how to read back the cookie into a JS object
http://jsfiddle.net/LLujbb2h/2/