javascript - Why isn't this function reading and displaying cookie? -


i have written code. isn't displaying cookie. displays prompt again , again, whenever open page. how can correct it?

<body onload="myfunc()">  <script> function createcookie(value, exdays) {     var date= new date();     var d= date.settime(date.getdate()+(exdays*10000));     var e = date.toutcstring(d);     var g = document.cookie= "user="+value+";"+" "+"expires="+e;     return g; } function readcookie() {     var h = document.cookie;     var i= h.split(";");     return i[0]; }   function myfunc() {     var a= readcookie();     if(a!="")     {         alert("welcome"+a);     }     else     {         var b = prompt("enter name", "");         createcookie(b, 5);     } } 

javascript case sensitive:

var date = new date(); 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -