set cookie and get cookie with javascript

v..

New Member
I am trying to setCookie depending on which css file i choose in my Html. I have a form with list of options, and different css files as values. When i choose a file, it should be saved to cookie for about a weak, and next time you open your html file, it should be the previous file you chose.Javascript code:\[code\]function cssLayout() {document.getElementById("css").href = http://stackoverflow.com/questions/14573223/this.value;}function setCookie(){var datum = new Date("Februari 10, 2013");var kakdatum = datum.toGMTString();var kaka = "Css=document.getElementById("css").href" + kakdatum;document.cookie = kaka;}function getCookie(){alert(document.cookie);}\[/code\]Html code:\[code\]<form> Select your css layout:<br> <select id="myList"> <option value="http://stackoverflow.com/questions/14573223/style-1.css">CSS1</option> <option value="http://stackoverflow.com/questions/14573223/style-2.css">CSS2</option> <option value="http://stackoverflow.com/questions/14573223/style-3.css">CSS3</option> <option value="http://stackoverflow.com/questions/14573223/style-4.css">CSS4</option> </select> </form>\[/code\]
 
Back
Top