Your mistake:
Typeerror: document.forms.myCity.optionname undefined
I believe the problem is with this element:
<form name="myCity" action="http://mywebsite.com/" method="POST">
, id name. , , id, name <form>. -, , , MSN XHTML:
name XHTML 1.1 .
โโ XHML 1.1, :
W3 , name HTML 4.0, ID XHTML 1.1.
W3, ; :
name = cdata [CI] , . . . id .
id , :
<form name="myCity" id="myCity" action="http://mywebsite.com/" method="POST">
name, id, XHTML 1.1.
- , JavaScript id:
function WriteCookie()
{
document.cookie = "city" + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
cookievalue = document.getElementById("myCity").optionname.value + ";";
document.cookie='city='+cookievalue +'; expires=Fri, 3 Aug 2021 20:47:11 UTC; path=/';
window.location.href = "http://mywebsite.com";
}
, :
cookievalue = document.forms['myCity'].optionname.value + ";";
:
cookievalue = document.getElementById("myCity").optionname.value + ";";