Cookie isn't being set in Chrome
I have Chrome 15.0.874.106. With the simple javascript code below, I never get a cookie set. Please help me figure this out. I'm not really a javascript expert. When you click the Add Item link, you get the prompt, you enter what ever data you need and click OK, but it never displays that cookie data in the laid out table like it's supposed to like IE does. What's wrong with the code that Chrome doesn't like? Thanks.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
    <title>My To Do List</title>
    <script type="text/javascript">

    var expDays = 365;
    var exp = new Date(); 
    exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
    var ShowCount = 0;
    var SwapColour;

    function PrintItem (ToDoItem, Count) {
    var color = "";
    SwapColour = 1 - SwapColour;
    if (SwapColour==1)
    {color = "bgcolor='#77bbff'";}
    else
    {color = "bgcolor='#99dd99'";}
    ShowCount++;
    document.write("<tr>+color");
    document.write("<td align=center width=20><font face=Calibri><b>+ShowCount");
    document.write("<td align=left width=425><font face=Calibri>+ToDoItem");
    document.write("<td align=center width=75><font size=2 font face=Calibri><a href='javascript:EditItem(Count)'>Edit</a> | <a   href='javascript:DeleteItem(Count)'>Delete</a>");
    }

    function getCookieVal (offset) {  
    var endstr = document.cookie.indexOf (";", offset);  
    if (endstr == -1)    
    endstr = document.cookie.length;  
    return unescape(document.cookie.substring(offset, endstr));
    }

    function GetCookie (name) {  
    var arg = name + "=";  
    var alen = arg.length;  
    var clen = document.cookie.length;  
    var i = 0;  
    while (i < clen) {    
    var j = i + alen;    
    if (document.cookie.substring(i, j) == arg)      
    return getCookieVal (j);    
    i = document.cookie.indexOf(" ", i) + 1;    
    if (i == 0) break;   
    }  
    return null;
    }

    function SetCookie (name, value) {  
    var argv = SetCookie.arguments;  
    var argc = SetCookie.arguments.length;  
    var expires = (argc > 2) ? argv[2] : null;  
    var path = (argc > 3) ? argv[3] : null;  
    var domain = (argc > 4) ? argv[4] : null;  
    var secure = (argc > 5) ? argv[5] : false;  
    document.cookie = name + "=" + escape (value) + 
    ((expires == null) ? "" : ("; expires=" + expires.toUTCString())) + 
    ((path == null) ? "" : ("; path=" + path)) +  
    ((domain == null) ? "" : ("; domain=" + domain)) +    
    ((secure == true) ? "; secure" : "");
    }

    function DeleteCookie (name) {  
    var exp = new Date();  
    exp.setTime (exp.getTime() - 1);  
    var cval = GetCookie (name);  
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
    }

    function DeleteItem(Count) {
    var d = confirm("Confirm Delete?");
    if (d){
    DeleteCookie('PT_ToDoItem'+Count);
    window.location = window.location;}
    }

    function EditItem(Count, ToDoItem) {
    var ToDoItem = GetCookie('PT_ToDoItem'+Count);
    var NumToDoItems = GetCookie('PT_NumToDoList');
    var EditItem = prompt("Edit item", ToDoItem);
    if ((EditItem != null) && (EditItem != "undefined" )) {
    NumToDoItems++;
    SetCookie(encodeURIComponent('PT_ToDoItem'+Count, EditItem, exp));
    SetCookie(encodeURIComponent('PT_NumToDoList',NumToDoItems, exp));
    window.location = window.location;}
    }

    function AddItem() {
    var NumToDoItems = GetCookie('PT_NumToDoList');
    var i;
    var ToDoItem;
    if (NumToDoItems == null) {
    NumToDoItems = 0;
    }
    ToDoItem = prompt("Enter new item", "");
    if ((ToDoItem != null) && (ToDoItem != "undefined" )) {
    NumToDoItems++;
    SetCookie(encodeURIComponent('PT_ToDoItem'+NumToDoItems, ToDoItem, exp));
    SetCookie(encodeURIComponent('PT_NumToDoList',NumToDoItems, exp));
    window.location = window.location;
       }
    }

    function ListToDoItems() {
    var NumToDoItems = GetCookie(decodeURIComponent('PT_NumToDoList'));
    var i;
    var ToDoItem;
    if (NumToDoItems == null) {
    NumToDoItems = 0;
    }
    ShowCount = 0; SwapColour = 0;
    for (i=1; i <= NumToDoItems; i++) {
    ToDoItem = GetCookie(decodeURIComponent('PT_ToDoItem'+i));
    if (ToDoItem != null) {
    PrintItem(ToDoItem, i);
          }
       }
    }
    </script>

    </head>

    <body>
    <p align=center>
    <font face="Calibri"><b>My To Do List</b><br>
    <a href="javascript:AddItem()">Add Item</a>
    </font>
    </p>
    <hr width="50%">
    <table align=center>
    <tr><td>
    <script type="text/javascript">
    ListToDoItems();
    </script>
    </td></tr>
    </table>
    <hr width="50%">
    </body>

    </html>

Cookie isn't being set in Chrome
===

I have Chrome 15.0.874.106. With the simple javascript code below, I never get a cookie set. Please help me figure this out. I'm not really a javascript expert. When you click the Add Item link, you get the prompt, you enter what ever data you need and click OK, but it never displays that cookie data in the laid out table like it's supposed to like IE does. What's wrong with the code that Chrome doesn't like? Thanks.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
    <title>My To Do List</title>
    <script type="text/javascript">

    var expDays = 365;
    var exp = new Date(); 
    exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
    var ShowCount = 0;
    var SwapColour;

    function PrintItem (ToDoItem, Count) {
    var color = "";
    SwapColour = 1 - SwapColour;
    if (SwapColour==1)
    {color = "bgcolor='#77bbff'";}
    else
    {color = "bgcolor='#99dd99'";}
    ShowCount++;
    document.write("<tr>+color");
    document.write("<td align=center width=20><font face=Calibri><b>+ShowCount");
    document.write("<td align=left width=425><font face=Calibri>+ToDoItem");
    document.write("<td align=center width=75><font size=2 font face=Calibri><a href='javascript:EditItem(Count)'>Edit</a> | <a   href='javascript:DeleteItem(Count)'>Delete</a>");
    }

    function getCookieVal (offset) {  
    var endstr = document.cookie.indexOf (";", offset);  
    if (endstr == -1)    
    endstr = document.cookie.length;  
    return unescape(document.cookie.substring(offset, endstr));
    }

    function GetCookie (name) {  
    var arg = name + "=";  
    var alen = arg.length;  
    var clen = document.cookie.length;  
    var i = 0;  
    while (i < clen) {    
    var j = i + alen;    
    if (document.cookie.substring(i, j) == arg)      
    return getCookieVal (j);    
    i = document.cookie.indexOf(" ", i) + 1;    
    if (i == 0) break;   
    }  
    return null;
    }

    function SetCookie (name, value) {  
    var argv = SetCookie.arguments;  
    var argc = SetCookie.arguments.length;  
    var expires = (argc > 2) ? argv[2] : null;  
    var path = (argc > 3) ? argv[3] : null;  
    var domain = (argc > 4) ? argv[4] : null;  
    var secure = (argc > 5) ? argv[5] : false;  
    document.cookie = name + "=" + escape (value) + 
    ((expires == null) ? "" : ("; expires=" + expires.toUTCString())) + 
    ((path == null) ? "" : ("; path=" + path)) +  
    ((domain == null) ? "" : ("; domain=" + domain)) +    
    ((secure == true) ? "; secure" : "");
    }

    function DeleteCookie (name) {  
    var exp = new Date();  
    exp.setTime (exp.getTime() - 1);  
    var cval = GetCookie (name);  
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
    }

    function DeleteItem(Count) {
    var d = confirm("Confirm Delete?");
    if (d){
    DeleteCookie('PT_ToDoItem'+Count);
    window.location = window.location;}
    }

    function EditItem(Count, ToDoItem) {
    var ToDoItem = GetCookie('PT_ToDoItem'+Count);
    var NumToDoItems = GetCookie('PT_NumToDoList');
    var EditItem = prompt("Edit item", ToDoItem);
    if ((EditItem != null) && (EditItem != "undefined" )) {
    NumToDoItems++;
    SetCookie(encodeURIComponent('PT_ToDoItem'+Count, EditItem, exp));
    SetCookie(encodeURIComponent('PT_NumToDoList',NumToDoItems, exp));
    window.location = window.location;}
    }

    function AddItem() {
    var NumToDoItems = GetCookie('PT_NumToDoList');
    var i;
    var ToDoItem;
    if (NumToDoItems == null) {
    NumToDoItems = 0;
    }
    ToDoItem = prompt("Enter new item", "");
    if ((ToDoItem != null) && (ToDoItem != "undefined" )) {
    NumToDoItems++;
    SetCookie(encodeURIComponent('PT_ToDoItem'+NumToDoItems, ToDoItem, exp));
    SetCookie(encodeURIComponent('PT_NumToDoList',NumToDoItems, exp));
    window.location = window.location;
       }
    }

    function ListToDoItems() {
    var NumToDoItems = GetCookie(decodeURIComponent('PT_NumToDoList'));
    var i;
    var ToDoItem;
    if (NumToDoItems == null) {
    NumToDoItems = 0;
    }
    ShowCount = 0; SwapColour = 0;
    for (i=1; i <= NumToDoItems; i++) {
    ToDoItem = GetCookie(decodeURIComponent('PT_ToDoItem'+i));
    if (ToDoItem != null) {
    PrintItem(ToDoItem, i);
          }
       }
    }
    </script>

    </head>

    <body>
    <p align=center>
    <font face="Calibri"><b>My To Do List</b><br>
    <a href="javascript:AddItem()">Add Item</a>
    </font>
    </p>
    <hr width="50%">
    <table align=center>
    <tr><td>
    <script type="text/javascript">
    ListToDoItems();
    </script>
    </td></tr>
    </table>
    <hr width="50%">
    </body>

    </html>
